fixes "flatnested" feature for out-of-scope defined nested classes
This commit is contained in:
parent
6d6cefa791
commit
8bc38dc007
2 changed files with 22 additions and 3 deletions
|
|
@ -1018,7 +1018,7 @@ static Node *nested_forward_declaration(const char *storage, const char *kind, S
|
|||
}
|
||||
}
|
||||
|
||||
if (!GetFlag(currentOuterClass, "nested")) {
|
||||
if (!currentOuterClass || !GetFlag(currentOuterClass, "nested")) {
|
||||
if (nn && Equal(nodeType(nn), "classforward")) {
|
||||
Node *n = nn;
|
||||
SWIG_WARN_NODE_BEGIN(n);
|
||||
|
|
@ -3451,8 +3451,14 @@ cpp_class_decl : storage_class cpptype idcolon inherit LBRACE {
|
|||
nscope = Getattr($<node>$, "nested:nscope");
|
||||
Delattr($<node>$, "nested:innerscope");
|
||||
Delattr($<node>$, "nested:nscope");
|
||||
if (nscope_inner && Strcmp(nodeType(nscope_inner), "class") == 0) /* actual parent class for this class */
|
||||
Setattr($$, "nested:outer", nscope_inner);
|
||||
if (nscope_inner && Strcmp(nodeType(nscope_inner), "class") == 0) { /* actual parent class for this class */
|
||||
Node* forward_declaration = Swig_symbol_clookup_no_inherit(Getattr($<node>$,"name"), Getattr(nscope_inner, "symtab"));
|
||||
if (forward_declaration) {
|
||||
Setattr($<node>$, "access", Getattr(forward_declaration, "access"));
|
||||
}
|
||||
Setattr($<node>$, "nested:outer", nscope_inner);
|
||||
SetFlag($<node>$, "nested");
|
||||
}
|
||||
if (!currentOuterClass)
|
||||
inclass = 0;
|
||||
cscope = Getattr($$, "prev_symtab");
|
||||
|
|
@ -3531,6 +3537,8 @@ cpp_class_decl : storage_class cpptype idcolon inherit LBRACE {
|
|||
} else if (nscope_inner) {
|
||||
/* this is tricky */
|
||||
/* we add the declaration in the original namespace */
|
||||
if (Strcmp(nodeType(nscope_inner), "class") == 0 && cparse_cplusplus && ignore_nested_classes && !GetFlag($$, "feature:flatnested"))
|
||||
$$ = nested_forward_declaration($1, $2, $3, Copy($3), $9);
|
||||
appendChild(nscope_inner, $$);
|
||||
Swig_symbol_setscope(Getattr(nscope_inner, "symtab"));
|
||||
Delete(Namespaceprefix);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue