better handling of using directives
This commit is contained in:
parent
d2d2bfa05f
commit
63452e9fc1
6 changed files with 100 additions and 3 deletions
|
|
@ -221,6 +221,7 @@ extern "C" {
|
|||
extern void Swig_symbol_print_tables_summary(void);
|
||||
extern void Swig_symbol_print_symbols(void);
|
||||
extern void Swig_symbol_print_csymbols(void);
|
||||
extern void Swig_symbol_add_using(String * name, String * uname, Node * n);
|
||||
extern void Swig_symbol_init(void);
|
||||
extern void Swig_symbol_setscopename(const_String_or_char_ptr name);
|
||||
extern String *Swig_symbol_getscopename(void);
|
||||
|
|
|
|||
|
|
@ -382,6 +382,26 @@ String *Swig_symbol_qualified_language_scopename(Symtab *n) {
|
|||
return result;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Swig_symbol_add_using()
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
void Swig_symbol_add_using(String * name, String * uname, Node * n) {
|
||||
Hash *h;
|
||||
h = Swig_symbol_clookup(uname,0);
|
||||
if (h && checkAttribute(h, "kind", "class")) {
|
||||
String *qcurrent = Swig_symbol_qualifiedscopename(0);
|
||||
if (qcurrent) {
|
||||
Append(qcurrent, "::");
|
||||
Append(qcurrent, name);
|
||||
} else {
|
||||
qcurrent = NewString(name);
|
||||
}
|
||||
Setattr(symtabs, qcurrent, n);
|
||||
Delete(qcurrent);
|
||||
}
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Swig_symbol_newscope()
|
||||
*
|
||||
|
|
@ -1074,7 +1094,19 @@ static Node *symbol_lookup_qualified(const_String_or_char_ptr name, Symtab *symt
|
|||
Delete(qalloc);
|
||||
return st;
|
||||
}
|
||||
n = symbol_lookup(name, st, checkfunc);
|
||||
if (checkAttribute(st, "nodeType", "using")) {
|
||||
String *uname = Getattr(st, "uname");
|
||||
if (uname) {
|
||||
st = Getattr(symtabs, uname);
|
||||
if (st) {
|
||||
n = symbol_lookup(name, st, checkfunc);
|
||||
} else {
|
||||
fprintf(stderr, "Error: Found corrupt 'using' node\n");
|
||||
}
|
||||
}
|
||||
} else if (Getattr(st, "csymtab")) {
|
||||
n = symbol_lookup(name, st, checkfunc);
|
||||
}
|
||||
}
|
||||
if (qalloc)
|
||||
Delete(qalloc);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue