fixed enums & enum values language symbol table namespace
fixed skipping of %templates in %extend if they are in the wrong scope
This commit is contained in:
parent
b4fef06c42
commit
715e254e05
4 changed files with 62 additions and 30 deletions
|
|
@ -2676,7 +2676,8 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va
|
|||
Setattr(templnode,"sym:typename","1");
|
||||
}
|
||||
/* for now, nested %template is allowed only in the same scope as the template declaration */
|
||||
if ($3 && !(currentOuterClass && (currentOuterClass != Getattr(nn, "nested:outer")))) {
|
||||
if ($3 && !((currentOuterClass && (currentOuterClass != Getattr(nn, "nested:outer")))
|
||||
||(extendmode && current_class && (current_class != Getattr(nn, "nested:outer"))))) {
|
||||
/*
|
||||
Comment this out for 1.3.28. We need to
|
||||
re-enable it later but first we need to
|
||||
|
|
|
|||
|
|
@ -1107,6 +1107,30 @@ public:
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
String *getCurrentScopeName(String *nspace)
|
||||
{
|
||||
String *scope = 0;
|
||||
if (nspace || getCurrentClass()) {
|
||||
scope = NewString("");
|
||||
if (nspace)
|
||||
Printf(scope, "%s", nspace);
|
||||
if (Node* cls = getCurrentClass())
|
||||
{
|
||||
if (Node *outer = Getattr(cls, "nested:outer")) {
|
||||
String *outerClassesPrefix = Copy(Getattr(outer, "sym:name"));
|
||||
for (outer = Getattr(outer, "nested:outer"); outer != 0; outer = Getattr(outer, "nested:outer")) {
|
||||
Push(outerClassesPrefix, ".");
|
||||
Push(outerClassesPrefix, Getattr(outer, "sym:name"));
|
||||
}
|
||||
Printv(scope, nspace ? "." : "", outerClassesPrefix, ".", proxy_class_name, NIL);
|
||||
Delete(outerClassesPrefix);
|
||||
} else
|
||||
Printv(scope, nspace ? "." : "", proxy_class_name, NIL);
|
||||
}
|
||||
}
|
||||
return scope;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* enumDeclaration()
|
||||
|
|
@ -1150,14 +1174,7 @@ public:
|
|||
if ((enum_feature != SimpleEnum) && symname && typemap_lookup_type) {
|
||||
// Wrap (non-anonymous) C/C++ enum within a typesafe, typeunsafe or proper C# enum
|
||||
|
||||
String *scope = 0;
|
||||
if (nspace || proxy_class_name) {
|
||||
scope = NewString("");
|
||||
if (nspace)
|
||||
Printf(scope, "%s", nspace);
|
||||
if (proxy_class_name)
|
||||
Printv(scope, nspace ? "." : "", proxy_class_name, NIL);
|
||||
}
|
||||
String *scope = getCurrentScopeName(nspace);
|
||||
if (!addSymbol(symname, n, scope))
|
||||
return SWIG_ERROR;
|
||||
|
||||
|
|
@ -1305,12 +1322,11 @@ public:
|
|||
scope = Copy(module_class_name);
|
||||
}
|
||||
} else {
|
||||
scope = NewString("");
|
||||
if (nspace)
|
||||
Printf(scope, "%s.", nspace);
|
||||
if (proxy_class_name)
|
||||
Printf(scope, "%s.", proxy_class_name);
|
||||
Printf(scope, "%s",Getattr(parent, "sym:name"));
|
||||
scope = getCurrentScopeName(nspace);
|
||||
if (!scope)
|
||||
scope = Copy(Getattr(parent, "sym:name"));
|
||||
else
|
||||
Printf(scope, ".%s", Getattr(parent, "sym:name"));
|
||||
}
|
||||
if (!addSymbol(name, n, scope))
|
||||
return SWIG_ERROR;
|
||||
|
|
|
|||
|
|
@ -1194,6 +1194,30 @@ public:
|
|||
return ret;
|
||||
}
|
||||
|
||||
String *getCurrentScopeName(String *nspace)
|
||||
{
|
||||
String *scope = 0;
|
||||
if (nspace || getCurrentClass()) {
|
||||
scope = NewString("");
|
||||
if (nspace)
|
||||
Printf(scope, "%s", nspace);
|
||||
if (Node* cls = getCurrentClass())
|
||||
{
|
||||
if (Node *outer = Getattr(cls, "nested:outer")) {
|
||||
String *outerClassesPrefix = Copy(Getattr(outer, "sym:name"));
|
||||
for (outer = Getattr(outer, "nested:outer"); outer != 0; outer = Getattr(outer, "nested:outer")) {
|
||||
Push(outerClassesPrefix, ".");
|
||||
Push(outerClassesPrefix, Getattr(outer, "sym:name"));
|
||||
}
|
||||
Printv(scope, nspace ? "." : "", outerClassesPrefix, ".", proxy_class_name, NIL);
|
||||
Delete(outerClassesPrefix);
|
||||
} else
|
||||
Printv(scope, nspace ? "." : "", proxy_class_name, NIL);
|
||||
}
|
||||
}
|
||||
return scope;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* enumDeclaration()
|
||||
*
|
||||
|
|
@ -1227,14 +1251,7 @@ public:
|
|||
if ((enum_feature != SimpleEnum) && symname && typemap_lookup_type) {
|
||||
// Wrap (non-anonymous) C/C++ enum within a typesafe, typeunsafe or proper Java enum
|
||||
|
||||
String *scope = 0;
|
||||
if (nspace || proxy_class_name) {
|
||||
scope = NewString("");
|
||||
if (nspace)
|
||||
Printf(scope, "%s", nspace);
|
||||
if (proxy_class_name)
|
||||
Printv(scope, nspace ? "." : "", proxy_class_name, NIL);
|
||||
}
|
||||
String *scope = getCurrentScopeName(nspace);
|
||||
if (!addSymbol(symname, n, scope))
|
||||
return SWIG_ERROR;
|
||||
|
||||
|
|
@ -1389,12 +1406,11 @@ public:
|
|||
scope = Copy(constants_interface_name);
|
||||
}
|
||||
} else {
|
||||
scope = NewString("");
|
||||
if (nspace)
|
||||
Printf(scope, "%s.", nspace);
|
||||
if (proxy_class_name)
|
||||
Printf(scope, "%s.", proxy_class_name);
|
||||
Printf(scope, "%s",Getattr(parent, "sym:name"));
|
||||
scope = getCurrentScopeName(nspace);
|
||||
if (!scope)
|
||||
scope = Copy(Getattr(parent, "sym:name"));
|
||||
else
|
||||
Printf(scope, ".%s", Getattr(parent, "sym:name"));
|
||||
}
|
||||
if (!addSymbol(name, n, scope))
|
||||
return SWIG_ERROR;
|
||||
|
|
|
|||
|
|
@ -3620,4 +3620,3 @@ Language *Language::instance() {
|
|||
Hash *Language::getClassHash() const {
|
||||
return classhash;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue