Director fixes for operator method names and destructors.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4702 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Mark Rose 2003-04-23 23:11:53 +00:00
commit 4b7e5fdffe
2 changed files with 13 additions and 3 deletions

View file

@ -1,5 +1,12 @@
Version 1.3.20 (In progress) Version 1.3.20 (In progress)
============================ ============================
04/23/2003: mrose (Mark Rose)
Fixed symname error in director calls to Python methods
that extend C++ operators.
Stopped director destructor wrappers from calling __set_up,
which was leaving the director flag in an inconsistent state.
04/23/2003: beazley 04/23/2003: beazley
Fixed problem with namespace resolution and nested namespaces. Fixed problem with namespace resolution and nested namespaces.
Reported by Alfred Lorber (and Marcelo Matus). Reported by Alfred Lorber (and Marcelo Matus).

View file

@ -656,6 +656,7 @@ public:
/* member of a director class? */ /* member of a director class? */
String *nodeType = Getattr(n, "nodeType"); String *nodeType = Getattr(n, "nodeType");
int constructor = (!Cmp(nodeType, "constructor")); int constructor = (!Cmp(nodeType, "constructor"));
int destructor = (!Cmp(nodeType, "destructor"));
String *storage = Getattr(n,"storage"); String *storage = Getattr(n,"storage");
int isVirtual = (Cmp(storage,"virtual") == 0); int isVirtual = (Cmp(storage,"virtual") == 0);
@ -869,7 +870,7 @@ public:
if (directorsEnabled()) { if (directorsEnabled()) {
if (!is_smart_pointer()) { if (!is_smart_pointer()) {
if (/*directorbase &&*/ !constructor && isVirtual) { if (/*directorbase &&*/ !constructor && !destructor && isVirtual) {
Wrapper_add_local(f, "director", "__DIRECTOR__ *director = 0"); Wrapper_add_local(f, "director", "__DIRECTOR__ *director = 0");
Printf(f->code, "director = dynamic_cast<__DIRECTOR__*>(arg1);\n"); Printf(f->code, "director = dynamic_cast<__DIRECTOR__*>(arg1);\n");
Printf(f->code, "if (director && (director->__get_self()==obj0)) director->__set_up();\n"); Printf(f->code, "if (director && (director->__get_self()==obj0)) director->__set_up();\n");
@ -1467,11 +1468,13 @@ public:
/* wrap complex arguments to PyObjects */ /* wrap complex arguments to PyObjects */
Printv(w->code, wrap_args, NIL); Printv(w->code, wrap_args, NIL);
String *pyname = Getattr(n,"sym:name");
/* pass the method call on to the Python object */ /* pass the method call on to the Python object */
if (Len(parse_args) > 0) { if (Len(parse_args) > 0) {
Printf(w->code, "result = PyObject_CallMethod(__get_self(), \"%s\", \"%s\" %s);\n", name, parse_args, arglist); Printf(w->code, "result = PyObject_CallMethod(__get_self(), \"%s\", \"%s\" %s);\n", pyname, parse_args, arglist);
} else { } else {
Printf(w->code, "result = PyObject_CallMethod(__get_self(), \"%s\", NULL);\n", name); Printf(w->code, "result = PyObject_CallMethod(__get_self(), \"%s\", NULL);\n", pyname);
} }
/* exception handling */ /* exception handling */