Fix using declarations combined with using directives with forward class
references. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13502 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
1e1c0ad951
commit
6e6ce16e4e
11 changed files with 388 additions and 16 deletions
|
|
@ -227,6 +227,7 @@ extern "C" {
|
|||
extern void Swig_symbol_cadd(const_String_or_char_ptr symname, Node *node);
|
||||
extern Node *Swig_symbol_clookup(const_String_or_char_ptr symname, Symtab *tab);
|
||||
extern Node *Swig_symbol_clookup_check(const_String_or_char_ptr symname, Symtab *tab, int (*check) (Node *));
|
||||
extern Node *Swig_symbol_clookup_no_inherit(const_String_or_char_ptr name, Symtab *n);
|
||||
extern Symtab *Swig_symbol_cscope(const_String_or_char_ptr symname, Symtab *tab);
|
||||
extern Node *Swig_symbol_clookup_local(const_String_or_char_ptr symname, Symtab *tab);
|
||||
extern Node *Swig_symbol_clookup_local_check(const_String_or_char_ptr symname, Symtab *tab, int (*check) (Node *));
|
||||
|
|
|
|||
|
|
@ -176,6 +176,8 @@ static Hash *current_symtab = 0; /* Current symbol table node */
|
|||
static Hash *symtabs = 0; /* Hash of all symbol tables by fully-qualified name */
|
||||
static Hash *global_scope = 0; /* Global scope */
|
||||
|
||||
static int use_inherit = 1;
|
||||
|
||||
/* common attribute keys, to avoid calling find_key all the times */
|
||||
|
||||
|
||||
|
|
@ -482,9 +484,9 @@ void Swig_symbol_alias(const_String_or_char_ptr aliasname, Symtab *s) {
|
|||
/* -----------------------------------------------------------------------------
|
||||
* Swig_symbol_inherit()
|
||||
*
|
||||
* Inherit symbols from another scope.
|
||||
* Primarily for using directives, such as 'using namespace X;'.
|
||||
* Not for using declarations, such as 'using A;'.
|
||||
* Inherit symbols from another scope. Primarily for C++ inheritance and
|
||||
* for using directives, such as 'using namespace X;'
|
||||
* but not for using declarations, such as 'using A;'.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
void Swig_symbol_inherit(Symtab *s) {
|
||||
|
|
@ -970,7 +972,7 @@ static Node *_symbol_lookup(const String *name, Symtab *symtab, int (*check) (No
|
|||
}
|
||||
|
||||
inherit = Getattr(symtab, "inherit");
|
||||
if (inherit) {
|
||||
if (inherit && use_inherit) {
|
||||
int i, len;
|
||||
len = Len(inherit);
|
||||
for (i = 0; i < len; i++) {
|
||||
|
|
@ -1060,7 +1062,7 @@ static Node *symbol_lookup_qualified(const_String_or_char_ptr name, Symtab *symt
|
|||
/* Check inherited scopes */
|
||||
if (!n) {
|
||||
List *inherit = Getattr(symtab, "inherit");
|
||||
if (inherit) {
|
||||
if (inherit && use_inherit) {
|
||||
int i, len;
|
||||
len = Len(inherit);
|
||||
for (i = 0; i < len; i++) {
|
||||
|
|
@ -1327,6 +1329,11 @@ Node *Swig_symbol_clookup_local_check(const_String_or_char_ptr name, Symtab *n,
|
|||
return s;
|
||||
}
|
||||
|
||||
Node *Swig_symbol_clookup_no_inherit(const_String_or_char_ptr name, Symtab *n) {
|
||||
use_inherit = 0;
|
||||
Swig_symbol_clookup(name, n);
|
||||
use_inherit = 1;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Swig_symbol_cscope()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue