Classprefix fixed after private nested classes
some comments and spaces added
This commit is contained in:
parent
b0afa8a95c
commit
44323e14b3
1 changed files with 58 additions and 60 deletions
|
|
@ -3483,20 +3483,21 @@ cpp_class_decl : storage_class cpptype idcolon inherit LBRACE {
|
||||||
|
|
||||||
if (extendhash) {
|
if (extendhash) {
|
||||||
String *clsname = Swig_symbol_qualifiedscopename(0);
|
String *clsname = Swig_symbol_qualifiedscopename(0);
|
||||||
am = Getattr(extendhash,clsname);
|
am = Getattr(extendhash, clsname);
|
||||||
if (am) {
|
if (am) {
|
||||||
merge_extensions($$,am);
|
merge_extensions($$, am);
|
||||||
Delattr(extendhash,clsname);
|
Delattr(extendhash, clsname);
|
||||||
}
|
}
|
||||||
Delete(clsname);
|
Delete(clsname);
|
||||||
}
|
}
|
||||||
if (!classes) classes = NewHash();
|
if (!classes) classes = NewHash();
|
||||||
scpname = Swig_symbol_qualifiedscopename(0);
|
scpname = Swig_symbol_qualifiedscopename(0);
|
||||||
Setattr(classes,scpname,$$);
|
Setattr(classes, scpname, $$);
|
||||||
|
|
||||||
appendChild($$,$7);
|
appendChild($$, $7);
|
||||||
|
|
||||||
if (am) append_previous_extension($$,am);
|
if (am)
|
||||||
|
append_previous_extension($$, am);
|
||||||
|
|
||||||
p = $9;
|
p = $9;
|
||||||
if (p && !nscope_inner) {
|
if (p && !nscope_inner) {
|
||||||
|
|
@ -3511,14 +3512,14 @@ cpp_class_decl : storage_class cpptype idcolon inherit LBRACE {
|
||||||
} else if (cparse_cplusplus && !cparse_externc) {
|
} else if (cparse_cplusplus && !cparse_externc) {
|
||||||
ty = NewString($3);
|
ty = NewString($3);
|
||||||
} else {
|
} else {
|
||||||
ty = NewStringf("%s %s", $2,$3);
|
ty = NewStringf("%s %s", $2, $3);
|
||||||
}
|
}
|
||||||
while (p) {
|
while (p) {
|
||||||
Setattr(p,"storage",$1);
|
Setattr(p, "storage", $1);
|
||||||
Setattr(p,"type",ty);
|
Setattr(p, "type" ,ty);
|
||||||
if (!cparse_cplusplus && currentOuterClass && (!Getattr(currentOuterClass, "name") || CPlusPlusOut)) {
|
if (!cparse_cplusplus && currentOuterClass && (!Getattr(currentOuterClass, "name") || CPlusPlusOut)) {
|
||||||
SetFlag(p,"hasconsttype");
|
SetFlag(p, "hasconsttype");
|
||||||
SetFlag(p,"feature:immutable");
|
SetFlag(p, "feature:immutable");
|
||||||
}
|
}
|
||||||
p = nextSibling(p);
|
p = nextSibling(p);
|
||||||
}
|
}
|
||||||
|
|
@ -3530,71 +3531,68 @@ cpp_class_decl : storage_class cpptype idcolon inherit LBRACE {
|
||||||
/* we 'open' the class at the end, to allow %template
|
/* we 'open' the class at the end, to allow %template
|
||||||
to add new members */
|
to add new members */
|
||||||
Node *pa = new_node("access");
|
Node *pa = new_node("access");
|
||||||
Setattr(pa,"kind","public");
|
Setattr(pa, "kind", "public");
|
||||||
cplus_mode = CPLUS_PUBLIC;
|
cplus_mode = CPLUS_PUBLIC;
|
||||||
appendChild($$,pa);
|
appendChild($$, pa);
|
||||||
Delete(pa);
|
Delete(pa);
|
||||||
}
|
}
|
||||||
if (currentOuterClass)
|
if (currentOuterClass)
|
||||||
restore_access_mode($$);
|
restore_access_mode($$);
|
||||||
|
Setattr($$, "symtab", Swig_symbol_popscope());
|
||||||
|
Classprefix = Getattr($<node>$, "Classprefix");
|
||||||
|
Delattr($<node>$, "Classprefix");
|
||||||
if (cplus_mode == CPLUS_PRIVATE) {
|
if (cplus_mode == CPLUS_PRIVATE) {
|
||||||
$$ = 0; /* skip private nested classes */
|
$$ = 0; /* skip private nested classes */
|
||||||
|
} else if (nscope_inner) {
|
||||||
|
/* this is tricky */
|
||||||
|
/* we add the declaration in the original namespace */
|
||||||
|
appendChild(nscope_inner, $$);
|
||||||
|
Swig_symbol_setscope(Getattr(nscope_inner, "symtab"));
|
||||||
|
Delete(Namespaceprefix);
|
||||||
|
Namespaceprefix = Swig_symbol_qualifiedscopename(0);
|
||||||
|
yyrename = Copy(Getattr($<node>$, "class_rename"));
|
||||||
|
add_symbols($$);
|
||||||
|
Delattr($$, "class_rename");
|
||||||
|
/* but the variable definition in the current scope */
|
||||||
|
Swig_symbol_setscope(cscope);
|
||||||
|
Delete(Namespaceprefix);
|
||||||
|
Namespaceprefix = Swig_symbol_qualifiedscopename(0);
|
||||||
|
add_symbols($9);
|
||||||
|
if (nscope) {
|
||||||
|
$$ = nscope; /* here we return recreated namespace tower instead of the class itself */
|
||||||
|
if ($9)
|
||||||
|
appendSibling($$, $9);
|
||||||
|
}
|
||||||
|
else if (!SwigType_istemplate(ty) && template_parameters == 0) /* for tempalte we need the class itself */
|
||||||
|
$$ = $9;
|
||||||
} else {
|
} else {
|
||||||
Setattr($$,"symtab",Swig_symbol_popscope());
|
Delete(yyrename);
|
||||||
|
yyrename = 0;
|
||||||
Classprefix = Getattr($<node>$,"Classprefix");
|
Delete(Namespaceprefix);
|
||||||
Delattr($<node>$,"Classprefix");
|
Namespaceprefix = Swig_symbol_qualifiedscopename(0);
|
||||||
if (nscope_inner) {
|
if (!cparse_cplusplus && currentOuterClass) { /* nested C structs go into global scope*/
|
||||||
/* this is tricky */
|
Node *outer = currentOuterClass;
|
||||||
/* we add the declaration in the original namespace */
|
while (Getattr(outer, "nested:outer"))
|
||||||
if (cplus_mode != CPLUS_PRIVATE)
|
outer = Getattr(outer, "nested:outer");
|
||||||
appendChild(nscope_inner,$$);
|
appendSibling(outer, $$);
|
||||||
Swig_symbol_setscope(Getattr(nscope_inner,"symtab"));
|
add_symbols($9);
|
||||||
|
set_scope_to_global();
|
||||||
Delete(Namespaceprefix);
|
Delete(Namespaceprefix);
|
||||||
Namespaceprefix = Swig_symbol_qualifiedscopename(0);
|
Namespaceprefix = Swig_symbol_qualifiedscopename(0);
|
||||||
yyrename = Copy(Getattr($<node>$, "class_rename"));
|
yyrename = Copy(Getattr($<node>$, "class_rename"));
|
||||||
add_symbols($$);
|
add_symbols($$);
|
||||||
|
if (!CPlusPlusOut)
|
||||||
|
Delattr($$, "nested:outer");
|
||||||
Delattr($$, "class_rename");
|
Delattr($$, "class_rename");
|
||||||
/* but the variable definition in the current scope */
|
$$ = 0;
|
||||||
Swig_symbol_setscope(cscope);
|
|
||||||
Delete(Namespaceprefix);
|
|
||||||
Namespaceprefix = Swig_symbol_qualifiedscopename(0);
|
|
||||||
add_symbols($9);
|
|
||||||
if (nscope) {
|
|
||||||
$$ = nscope;
|
|
||||||
if ($9)
|
|
||||||
appendSibling($$, $9);
|
|
||||||
}
|
|
||||||
else if (!SwigType_istemplate(ty) && template_parameters == 0)
|
|
||||||
$$ = $9;
|
|
||||||
} else {
|
} else {
|
||||||
Delete(yyrename);
|
yyrename = Copy(Getattr($<node>$, "class_rename"));
|
||||||
yyrename = 0;
|
add_symbols($$);
|
||||||
Delete(Namespaceprefix);
|
add_symbols($9);
|
||||||
Namespaceprefix = Swig_symbol_qualifiedscopename(0);
|
Delattr($$, "class_rename");
|
||||||
if (!cparse_cplusplus && currentOuterClass) { /* nested C structs go into global scope*/
|
|
||||||
Node *outer = currentOuterClass;
|
|
||||||
while (Getattr(outer, "nested:outer"))
|
|
||||||
outer = Getattr(outer, "nested:outer");
|
|
||||||
appendSibling(outer, $$);
|
|
||||||
add_symbols($9);
|
|
||||||
set_scope_to_global();
|
|
||||||
Delete(Namespaceprefix);
|
|
||||||
Namespaceprefix = Swig_symbol_qualifiedscopename(0);
|
|
||||||
yyrename = Copy(Getattr($<node>$, "class_rename"));
|
|
||||||
add_symbols($$);
|
|
||||||
if (!CPlusPlusOut)
|
|
||||||
Delattr($$, "nested:outer");
|
|
||||||
Delattr($$, "class_rename");
|
|
||||||
$$ = 0;
|
|
||||||
} else {
|
|
||||||
yyrename = Copy(Getattr($<node>$, "class_rename"));
|
|
||||||
add_symbols($$);
|
|
||||||
add_symbols($9);
|
|
||||||
Delattr($$, "class_rename");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Delete(ty);
|
||||||
Swig_symbol_setscope(cscope);
|
Swig_symbol_setscope(cscope);
|
||||||
Delete(Namespaceprefix);
|
Delete(Namespaceprefix);
|
||||||
Namespaceprefix = Swig_symbol_qualifiedscopename(0);
|
Namespaceprefix = Swig_symbol_qualifiedscopename(0);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue