Fixed problem with smart pointers and overloaded static methods.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5190 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Dave Beazley 2003-10-14 19:02:10 +00:00
commit ff1bedc094
3 changed files with 27 additions and 7 deletions

View file

@ -493,6 +493,13 @@ public:
if (checkAttribute(n, "storage", "virtual"))
class_member_is_defined_in_bases(n, inclass);
/* Check to see if this is a static member or not. If so, we add an attribute
cplus:staticbase that saves the current class */
if (checkAttribute(n,"storage","static")) {
Setattr(n,"cplus:staticbase", inclass);
}
String *name = Getattr(n,"name");
if (cplus_mode != PUBLIC) {
/* Look for a private assignment operator */
@ -522,6 +529,7 @@ public:
}
List *methods = smart_pointer_methods(sc,0,isconst);
Setattr(inclass,"allocate:smartpointer",methods);
Setattr(inclass,"allocate:smartpointerbase",base);
break;
} else {
/* Hmmm. The return value is not a pointer. If the type is a value

View file

@ -1014,7 +1014,12 @@ Language::staticmemberfunctionHandler(Node *n) {
String *cname, *mrename;
if (!Extend) {
cname = NewStringf("%s::%s",ClassName,name);
String *sname = Getattr(Getattr(n,"cplus:staticbase"),"name");
if (sname) {
cname = NewStringf("%s::%s",sname,name);
} else {
cname = NewStringf("%s::%s",ClassName,name);
}
} else {
cname = Copy(Swig_name_member(ClassPrefix,name));
}

View file

@ -45,14 +45,21 @@ Swig_overload_rank(Node *n) {
c = o;
while (c) {
if (!Getattr(c,"error")) {
if (Getattr(c,"wrap:name")) {
nodes[nnodes].n = c;
nodes[nnodes].parms = Getattr(c,"wrap:parms");
nodes[nnodes].argc = emit_num_required(nodes[nnodes].parms);
if (Getattr(c,"error")) {
c = Getattr(c,"sym:nextSibling");
continue;
}
/* if (SmartPointer && Getattr(c,"cplus:staticbase")) {
c = Getattr(c,"sym:nextSibling");
continue;
} */
if (Getattr(c,"wrap:name")) {
nodes[nnodes].n = c;
nodes[nnodes].parms = Getattr(c,"wrap:parms");
nodes[nnodes].argc = emit_num_required(nodes[nnodes].parms);
nodes[nnodes].error = 0;
nnodes++;
}
}
c = Getattr(c,"sym:nextSibling");
}