fixes for the new default argument wrapping in director constructors and virtual methods

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6354 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2004-10-06 21:10:24 +00:00
commit bbb97f8e6d
4 changed files with 105 additions and 90 deletions

View file

@ -3308,11 +3308,14 @@ class JAVA : public Language {
if (status == SWIG_OK && output_director) { if (status == SWIG_OK && output_director) {
if(!is_void) { if(!is_void) {
Replaceall(w->code,"$null", qualified_return); Replaceall(w->code,"$null", qualified_return);
} else } else {
Replaceall(w->code,"$null",""); Replaceall(w->code,"$null","");
Wrapper_print(w, f_directors); }
Wrapper_print(imw, imclass_directors); Wrapper_print(imw, imclass_directors);
Printv(f_directors_h, declaration, NIL); if (!Getattr(n,"defaultargs")) {
Wrapper_print(w, f_directors);
Printv(f_directors_h, declaration, NIL);
}
} }
Delete(qualified_return); Delete(qualified_return);
@ -3382,28 +3385,30 @@ class JAVA : public Language {
directorPrefixArgs(n); directorPrefixArgs(n);
/* constructor */ if (!Getattr(n,"defaultargs")) {
{ /* constructor */
String *basetype = Getattr(parent, "classtype"); {
String *target = Swig_method_decl(decl, classname, parms, 0, 0); String *basetype = Getattr(parent, "classtype");
String *call = Swig_csuperclass_call(0, basetype, superparms); String *target = Swig_method_decl(decl, classname, parms, 0, 0);
String *classtype = SwigType_namestr(Getattr(n, "name")); String *call = Swig_csuperclass_call(0, basetype, superparms);
String *dirclass_type = SwigType_namestr(Getattr(n, "sym:name")); String *classtype = SwigType_namestr(Getattr(n, "name"));
String *dirclass_type = SwigType_namestr(Getattr(n, "sym:name"));
Printf(f_directors, "%s::%s: %s, %s {\n", classname, target, call, Getattr(parent, "director:ctor")); Printf(f_directors, "%s::%s: %s, %s {\n", classname, target, call, Getattr(parent, "director:ctor"));
Printf(f_directors, "}\n\n"); Printf(f_directors, "}\n\n");
Delete(dirclass_type); Delete(dirclass_type);
Delete(classtype); Delete(classtype);
Delete(target); Delete(target);
Delete(call); Delete(call);
} }
/* constructor header */ /* constructor header */
{ {
String *target = Swig_method_decl(decl, classname, parms, 0, 1); String *target = Swig_method_decl(decl, classname, parms, 0, 1);
Printf(f_directors_h, " %s;\n", target); Printf(f_directors_h, " %s;\n", target);
Delete(target); Delete(target);
}
} }
Delete(sub); Delete(sub);

View file

@ -1750,8 +1750,10 @@ public:
/* emit the director method */ /* emit the director method */
if (status == SWIG_OK) { if (status == SWIG_OK) {
if (!Getattr(n,"defaultargs")) {
Wrapper_print(w, f_directors); Wrapper_print(w, f_directors);
Printv(f_directors_h, declaration, NIL); Printv(f_directors_h, declaration, NIL);
}
} }
/* clean up */ /* clean up */
@ -1795,30 +1797,30 @@ public:
Setattr(p, "value", "0"); Setattr(p, "value", "0");
set_nextSibling(ip, p); set_nextSibling(ip, p);
/* constructor */ if (!Getattr(n,"defaultargs")) {
{ /* constructor */
Wrapper *w = NewWrapper(); {
String *call; Wrapper *w = NewWrapper();
String *basetype = Getattr(parent, "classtype"); String *call;
String *target = Swig_method_decl(decl, classname, parms, String *basetype = Getattr(parent, "classtype");
0, 0); String *target = Swig_method_decl(decl, classname, parms, 0, 0);
call = Swig_csuperclass_call(0, basetype, superparms); call = Swig_csuperclass_call(0, basetype, superparms);
Printf( w->def, Printf( w->def,
"%s::%s: %s, Swig::Director(self, disown) { }", "%s::%s: %s, Swig::Director(self, disown) { }",
classname, target, call ); classname, target, call );
Delete(target); Delete(target);
Wrapper_print(w, f_directors); Wrapper_print(w, f_directors);
Delete(call); Delete(call);
DelWrapper(w); DelWrapper(w);
} }
/* constructor header */ /* constructor header */
{ {
String *target = Swig_method_decl(decl, classname, String *target = Swig_method_decl(decl, classname, parms, 0, 1);
parms, 0, 1); Printf(f_directors_h, " %s;\n", target);
Printf(f_directors_h, " %s;\n", target); Delete(target);
Delete(target); }
} }
Setattr(n,"parms",q); Setattr(n,"parms",q);
Language::classDirectorConstructor(n); Language::classDirectorConstructor(n);

View file

@ -1993,8 +1993,10 @@ public:
/* emit the director method */ /* emit the director method */
if (status == SWIG_OK) { if (status == SWIG_OK) {
Wrapper_print(w, f_directors); if (!Getattr(n,"defaultargs")) {
Printv(f_directors_h, declaration, NIL); Wrapper_print(w, f_directors);
Printv(f_directors_h, declaration, NIL);
}
} }
/* clean up */ /* clean up */
@ -2038,25 +2040,27 @@ public:
Setattr(p, "value", "false"); Setattr(p, "value", "false");
set_nextSibling(ip, p); set_nextSibling(ip, p);
/* constructor */ if (!Getattr(n,"defaultargs")) {
{ /* constructor */
Wrapper *w = NewWrapper(); {
String *call; Wrapper *w = NewWrapper();
String *basetype = Getattr(parent, "classtype"); String *call;
String *target = Swig_method_decl(decl, classname, parms, 0, 0); String *basetype = Getattr(parent, "classtype");
call = Swig_csuperclass_call(0, basetype, superparms); String *target = Swig_method_decl(decl, classname, parms, 0, 0);
Printf(w->def, "%s::%s: %s, Swig::Director(self, disown) { }", classname, target, call); call = Swig_csuperclass_call(0, basetype, superparms);
Delete(target); Printf(w->def, "%s::%s: %s, Swig::Director(self, disown) { }", classname, target, call);
Wrapper_print(w, f_directors); Delete(target);
Delete(call); Wrapper_print(w, f_directors);
DelWrapper(w); Delete(call);
} DelWrapper(w);
}
/* constructor header */
{ /* constructor header */
String *target = Swig_method_decl(decl, classname, parms, 0, 1); {
Printf(f_directors_h, " %s;\n", target); String *target = Swig_method_decl(decl, classname, parms, 0, 1);
Delete(target); Printf(f_directors_h, " %s;\n", target);
Delete(target);
}
} }
Delete(sub); Delete(sub);

View file

@ -1911,25 +1911,27 @@ public:
Setattr(p, "value", "false"); Setattr(p, "value", "false");
set_nextSibling(ip, p); set_nextSibling(ip, p);
/* constructor */ if (!Getattr(n,"defaultargs")) {
{ /* constructor */
Wrapper *w = NewWrapper(); {
String *call; Wrapper *w = NewWrapper();
String *basetype = Getattr(parent, "classtype"); String *call;
String *target = Swig_method_decl(decl, classname, parms, 0, 0); String *basetype = Getattr(parent, "classtype");
call = Swig_csuperclass_call(0, basetype, superparms); String *target = Swig_method_decl(decl, classname, parms, 0, 0);
Printf(w->def, "%s::%s: %s, Swig::Director(self, disown) { }", classname, target, call); call = Swig_csuperclass_call(0, basetype, superparms);
Delete(target); Printf(w->def, "%s::%s: %s, Swig::Director(self, disown) { }", classname, target, call);
Wrapper_print(w, f_directors); Delete(target);
Delete(call); Wrapper_print(w, f_directors);
DelWrapper(w); Delete(call);
} DelWrapper(w);
}
/* constructor header */
{ /* constructor header */
String *target = Swig_method_decl(decl, classname, parms, 0, 1); {
Printf(f_directors_h, " %s;\n", target); String *target = Swig_method_decl(decl, classname, parms, 0, 1);
Delete(target); Printf(f_directors_h, " %s;\n", target);
Delete(target);
}
} }
Delete(sub); Delete(sub);
@ -1953,7 +1955,7 @@ public:
} }
/* --------------------------------------------------------------- /* ---------------------------------------------------------------
* classDirectorMethod() * exceptionSafeMethodCall()
* *
* Emit a virtual director method to pass a method call on to the * Emit a virtual director method to pass a method call on to the
* underlying Ruby instance. * underlying Ruby instance.
@ -2377,8 +2379,10 @@ public:
/* emit the director method */ /* emit the director method */
if (status == SWIG_OK) { if (status == SWIG_OK) {
Wrapper_print(w, f_directors); if (!Getattr(n,"defaultargs")) {
Printv(f_directors_h, declaration, NIL); Wrapper_print(w, f_directors);
Printv(f_directors_h, declaration, NIL);
}
} }
/* clean up */ /* clean up */