fixes for the nodirector feature and the '0' director member case
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5657 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
c2d143e442
commit
9cfb9a490b
6 changed files with 80 additions and 11 deletions
|
|
@ -2536,10 +2536,6 @@ class JAVA : public Language {
|
|||
int gencomma = 0;
|
||||
int classmeth_off = curr_class_dmethod - first_class_dmethod;
|
||||
|
||||
/* Skip out of here if nodirector is set */
|
||||
|
||||
if (!Cmp(Getattr(n, "feature:nodirector"), "1"))
|
||||
return SWIG_OK;
|
||||
|
||||
// This is a kludge: functionWrapper has sym:overload set properly, but it
|
||||
// isn't at this point, so we have to manufacture it ourselves. At least
|
||||
|
|
@ -3203,12 +3199,13 @@ class JAVA : public Language {
|
|||
Printf(w->code, "}\n");
|
||||
Printf(w->code, "bool derived = (jenv->IsSameObject(baseclass, jcls) ? false : true);\n");
|
||||
|
||||
if (first_class_dmethod != curr_class_dmethod) {
|
||||
int n_methods = curr_class_dmethod - first_class_dmethod;
|
||||
int n_methods = curr_class_dmethod - first_class_dmethod;
|
||||
Printf(f_directors_h, "protected:\n");
|
||||
Printf(f_directors_h, " bool swig_override[%d];\n", n_methods);
|
||||
|
||||
if (n_methods) {
|
||||
|
||||
/* Emit the code to look up the class's methods, initialize the override array */
|
||||
Printf(f_directors_h, "protected:\n");
|
||||
Printf(f_directors_h, " bool swig_override[%d];\n", n_methods);
|
||||
|
||||
Printf(w->code, "for (int i = 0; i < %d; ++i) {\n", n_methods);
|
||||
Printf(w->code, " if (methods[i].base_methid == NULL) {\n");
|
||||
|
|
|
|||
|
|
@ -1456,8 +1456,7 @@ int Language::unrollVirtualMethods(Node *n,
|
|||
if (!checkAttribute(ni, "storage", "virtual")) continue;
|
||||
nodeType = Getattr(ni, "nodeType");
|
||||
/* we need to add only the methods(cdecl), no destructors */
|
||||
if (Cmp(nodeType, "cdecl") == 0 &&
|
||||
!checkAttribute(ni, "feature:nodirector", "1")) {
|
||||
if ((Cmp(nodeType, "cdecl") == 0)) {
|
||||
decl = Getattr(ni, "decl");
|
||||
/* extra check for function type and proper access */
|
||||
if (SwigType_isfunction(decl) &&
|
||||
|
|
@ -1467,7 +1466,6 @@ int Language::unrollVirtualMethods(Node *n,
|
|||
String *method_id = NewStringf("%s|%s", name, local_decl);
|
||||
String *fqname = NewStringf("%s::%s", classname, name);
|
||||
Hash *item = NewHash();
|
||||
Setattr(ni, "feature:director", "1");
|
||||
Setattr(item, "fqName", fqname);
|
||||
Setattr(item, "methodNode", ni);
|
||||
Setattr(vm, method_id, item);
|
||||
|
|
@ -1557,6 +1555,9 @@ int Language::classDirectorMethods(Node *n) {
|
|||
item = k.item;
|
||||
String *method = Getattr(item, "methodNode");
|
||||
String *fqname = Getattr(item, "fqName");
|
||||
if (!Cmp(Getattr(method, "feature:nodirector"), "1"))
|
||||
continue;
|
||||
|
||||
if (classDirectorMethod(method, n, fqname) == SWIG_OK) {
|
||||
Setattr(item, "director", "1");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue