last fixes for namespaces
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6609 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
b41b869b38
commit
5206f539fd
1 changed files with 22 additions and 14 deletions
|
|
@ -713,10 +713,26 @@ static void merge_extensions(Node *cls, Node *am) {
|
||||||
return bases;
|
return bases;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the class name is qualified. We need to create or lookup namespace entries */
|
/* If the class name is qualified. We need to create or lookup namespace entries */
|
||||||
|
|
||||||
|
static Symtab *get_global_scope() {
|
||||||
|
Symtab *symtab = Swig_symbol_current();
|
||||||
|
Node *pn = parentNode(symtab);
|
||||||
|
while (pn) {
|
||||||
|
symtab = pn;
|
||||||
|
pn = parentNode(symtab);
|
||||||
|
if (!pn) break;
|
||||||
|
}
|
||||||
|
Namespaceprefix = 0;
|
||||||
|
Swig_symbol_setscope(symtab);
|
||||||
|
return symtab;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static Node *nspace = 0;
|
static Node *nspace = 0;
|
||||||
static Node *nspace_inner = 0;
|
static Node *nspace_inner = 0;
|
||||||
static String *resolve_namespace_class(String *cname) {
|
static String *resolve_namespace_class(String *cname) {
|
||||||
|
Symtab *gscope = 0;
|
||||||
nspace = 0;
|
nspace = 0;
|
||||||
nspace_inner = 0;
|
nspace_inner = 0;
|
||||||
if (Swig_scopename_check(cname)) {
|
if (Swig_scopename_check(cname)) {
|
||||||
|
|
@ -724,25 +740,17 @@ static String *resolve_namespace_class(String *cname) {
|
||||||
String *prefix = Swig_scopename_prefix(cname);
|
String *prefix = Swig_scopename_prefix(cname);
|
||||||
String *base = Swig_scopename_last(cname);
|
String *base = Swig_scopename_last(cname);
|
||||||
if (prefix && (Strncmp(prefix,"::",2) == 0)) {
|
if (prefix && (Strncmp(prefix,"::",2) == 0)) {
|
||||||
|
/* Use the global scope */
|
||||||
String *nprefix = NewString(Char(prefix)+2);
|
String *nprefix = NewString(Char(prefix)+2);
|
||||||
Delete(prefix);
|
Delete(prefix);
|
||||||
prefix= nprefix;
|
prefix= nprefix;
|
||||||
Printf(stderr,"pb %s %s\n",prefix, base);
|
gscope = get_global_scope();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!prefix || (Len(prefix) == 0)) {
|
if (!prefix || (Len(prefix) == 0)) {
|
||||||
/* Use the global scope */
|
/* Use the global scope */
|
||||||
Symtab *symtab = Swig_symbol_current();
|
if (!gscope) gscope = get_global_scope();
|
||||||
Node *pn = parentNode(symtab);
|
|
||||||
while (pn) {
|
|
||||||
symtab = pn;
|
|
||||||
pn = parentNode(symtab);
|
|
||||||
if (!pn) break;
|
|
||||||
}
|
|
||||||
Swig_symbol_setscope(symtab);
|
|
||||||
Namespaceprefix = 0;
|
|
||||||
nspace = new_node("namespace");
|
nspace = new_node("namespace");
|
||||||
Setattr(nspace,"symtab", symtab);
|
Setattr(nspace,"symtab", gscope);
|
||||||
nspace_inner = nspace;
|
nspace_inner = nspace;
|
||||||
return base;
|
return base;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue