commented out operators: '=', '&', '|' because they have no tests ; added check for reversed arguments in subtraction
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10336 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
ccff189174
commit
8c7d3c7ae3
1 changed files with 37 additions and 27 deletions
|
|
@ -1148,8 +1148,10 @@ public:
|
||||||
Printv(pm, tab4, "\"==\" => sub { $_[0]->__eq__($_[1])},\n",NIL);
|
Printv(pm, tab4, "\"==\" => sub { $_[0]->__eq__($_[1])},\n",NIL);
|
||||||
} else if (strstr(name, "__ne__")) {
|
} else if (strstr(name, "__ne__")) {
|
||||||
Printv(pm, tab4, "\"!=\" => sub { $_[0]->__ne__($_[1])},\n",NIL);
|
Printv(pm, tab4, "\"!=\" => sub { $_[0]->__ne__($_[1])},\n",NIL);
|
||||||
} else if (strstr(name, "__assign__")) {
|
// there are no tests for this in operator_overload_runme.pl
|
||||||
Printv(pm, tab4, "\"=\" => sub { $_[0]->__assign__($_[1])},\n", NIL);
|
// it is likely to be broken
|
||||||
|
// } else if (strstr(name, "__assign__")) {
|
||||||
|
// Printv(pm, tab4, "\"=\" => sub { $_[0]->__assign__($_[1])},\n",NIL);
|
||||||
} else if (strstr(name, "__str__")) {
|
} else if (strstr(name, "__str__")) {
|
||||||
Printv(pm, tab4, "'\"\"' => sub { $_[0]->__str__()},\n",NIL);
|
Printv(pm, tab4, "'\"\"' => sub { $_[0]->__str__()},\n",NIL);
|
||||||
} else if (strstr(name, "__plusplus__")) {
|
} else if (strstr(name, "__plusplus__")) {
|
||||||
|
|
@ -1159,17 +1161,25 @@ public:
|
||||||
} else if (strstr(name, "__add__")) {
|
} else if (strstr(name, "__add__")) {
|
||||||
Printv(pm, tab4, "\"+\" => sub { $_[0]->__add__($_[1])},\n",NIL);
|
Printv(pm, tab4, "\"+\" => sub { $_[0]->__add__($_[1])},\n",NIL);
|
||||||
} else if (strstr(name, "__sub__")) {
|
} else if (strstr(name, "__sub__")) {
|
||||||
Printv(pm, tab4, "\"-\" => sub { $_[0]->__sub__($_[1])},\n", NIL);
|
Printv(pm, tab4, "\"-\" => sub { if( not $_[2] ) { $_[0]->__sub__($_[1]) }\n",NIL);
|
||||||
|
Printv(pm, tab8, "elsif( $_[0]->can('__rsub__') ) { $_[0]->__rsub__($_[1]) }\n",NIL);
|
||||||
|
Printv(pm, tab8, "else { die(\"reverse subtraction not supported\") }\n",NIL);
|
||||||
|
Printv(pm, tab8, "},\n",NIL);
|
||||||
} else if (strstr(name, "__mul__")) {
|
} else if (strstr(name, "__mul__")) {
|
||||||
Printv(pm, tab4, "\"*\" => sub { $_[0]->__mul__($_[1])},\n",NIL);
|
Printv(pm, tab4, "\"*\" => sub { $_[0]->__mul__($_[1])},\n",NIL);
|
||||||
} else if (strstr(name, "__div__")) {
|
} else if (strstr(name, "__div__")) {
|
||||||
Printv(pm, tab4, "\"/\" => sub { $_[0]->__div__($_[1])},\n",NIL);
|
Printv(pm, tab4, "\"/\" => sub { $_[0]->__div__($_[1])},\n",NIL);
|
||||||
} else if (strstr(name, "__mod__")) {
|
} else if (strstr(name, "__mod__")) {
|
||||||
Printv(pm, tab4, "\"%\" => sub { $_[0]->__mod__($_[1])},\n",NIL);
|
Printv(pm, tab4, "\"%\" => sub { $_[0]->__mod__($_[1])},\n",NIL);
|
||||||
} else if (strstr(name, "__and__")) {
|
// there are no tests for this in operator_overload_runme.pl
|
||||||
Printv(pm, tab4, "\"&\" => sub { $_[0]->__and__($_[1])},\n", NIL);
|
// it is likely to be broken
|
||||||
} else if (strstr(name, "__or__")) {
|
// } else if (strstr(name, "__and__")) {
|
||||||
Printv(pm, tab4, "\"|\" => sub { $_[0]->__or__($_[1])},\n", NIL);
|
// Printv(pm, tab4, "\"&\" => sub { $_[0]->__and__($_[1])},\n",NIL);
|
||||||
|
|
||||||
|
// there are no tests for this in operator_overload_runme.pl
|
||||||
|
// it is likely to be broken
|
||||||
|
// } else if (strstr(name, "__or__")) {
|
||||||
|
// Printv(pm, tab4, "\"|\" => sub { $_[0]->__or__($_[1])},\n",NIL);
|
||||||
} else if (strstr(name, "__gt__")) {
|
} else if (strstr(name, "__gt__")) {
|
||||||
Printv(pm, tab4, "\">\" => sub { $_[0]->__gt__($_[1])},\n",NIL);
|
Printv(pm, tab4, "\">\" => sub { $_[0]->__gt__($_[1])},\n",NIL);
|
||||||
} else if (strstr(name, "__ge__")) {
|
} else if (strstr(name, "__ge__")) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue