Issue #508: Classprefix is not restored after nested structures processing. Also, Classprefix is incorrectly checked in some places.
This commit is contained in:
parent
350eff3687
commit
ec93b01a09
2 changed files with 17 additions and 5 deletions
|
|
@ -55,6 +55,10 @@
|
||||||
#pragma GCC diagnostic ignored "-Wpedantic"
|
#pragma GCC diagnostic ignored "-Wpedantic"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
namespace bar {
|
||||||
|
int foo() { return 0; }
|
||||||
|
}
|
||||||
|
|
||||||
struct Outer {
|
struct Outer {
|
||||||
typedef int Integer;
|
typedef int Integer;
|
||||||
///////////////////////////////////////////
|
///////////////////////////////////////////
|
||||||
|
|
@ -129,10 +133,16 @@ struct Outer {
|
||||||
Integer x;
|
Integer x;
|
||||||
} InnerClass4Typedef;
|
} InnerClass4Typedef;
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
int Outer::foo(){ return 1; } // should correctly ignore qualification here (#508)
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Integer x;
|
Integer x;
|
||||||
} InnerStruct4Typedef;
|
} InnerStruct4Typedef;
|
||||||
|
|
||||||
|
friend int bar::foo(); // should parse correctly (#508)
|
||||||
|
|
||||||
typedef union {
|
typedef union {
|
||||||
Integer x;
|
Integer x;
|
||||||
double y;
|
double y;
|
||||||
|
|
|
||||||
|
|
@ -2925,8 +2925,8 @@ c_decl : storage_class type declarator initializer c_decl_tail {
|
||||||
matches that of the declaration, then we will allow it. Otherwise, delete. */
|
matches that of the declaration, then we will allow it. Otherwise, delete. */
|
||||||
String *p = Swig_scopename_prefix($3.id);
|
String *p = Swig_scopename_prefix($3.id);
|
||||||
if (p) {
|
if (p) {
|
||||||
if ((Namespaceprefix && Strcmp(p,Namespaceprefix) == 0) ||
|
if ((Namespaceprefix && Strcmp(p, Namespaceprefix) == 0) ||
|
||||||
(inclass && Strcmp(p,Classprefix) == 0)) {
|
(Classprefix && Strcmp(p, Classprefix) == 0)) {
|
||||||
String *lstr = Swig_scopename_last($3.id);
|
String *lstr = Swig_scopename_last($3.id);
|
||||||
Setattr($$,"name",lstr);
|
Setattr($$,"name",lstr);
|
||||||
Delete(lstr);
|
Delete(lstr);
|
||||||
|
|
@ -2981,8 +2981,8 @@ c_decl : storage_class type declarator initializer c_decl_tail {
|
||||||
if (Strstr($3.id,"::")) {
|
if (Strstr($3.id,"::")) {
|
||||||
String *p = Swig_scopename_prefix($3.id);
|
String *p = Swig_scopename_prefix($3.id);
|
||||||
if (p) {
|
if (p) {
|
||||||
if ((Namespaceprefix && Strcmp(p,Namespaceprefix) == 0) ||
|
if ((Namespaceprefix && Strcmp(p, Namespaceprefix) == 0) ||
|
||||||
(inclass && Strcmp(p,Classprefix) == 0)) {
|
(Classprefix && Strcmp(p, Classprefix) == 0)) {
|
||||||
String *lstr = Swig_scopename_last($3.id);
|
String *lstr = Swig_scopename_last($3.id);
|
||||||
Setattr($$,"name",lstr);
|
Setattr($$,"name",lstr);
|
||||||
Delete(lstr);
|
Delete(lstr);
|
||||||
|
|
@ -3618,6 +3618,7 @@ cpp_class_decl : storage_class cpptype idcolon inherit LBRACE {
|
||||||
Swig_symbol_setscope(cscope);
|
Swig_symbol_setscope(cscope);
|
||||||
Delete(Namespaceprefix);
|
Delete(Namespaceprefix);
|
||||||
Namespaceprefix = Swig_symbol_qualifiedscopename(0);
|
Namespaceprefix = Swig_symbol_qualifiedscopename(0);
|
||||||
|
Classprefix = currentOuterClass ? Getattr(currentOuterClass, "Classprefix") : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* An unnamed struct, possibly with a typedef */
|
/* An unnamed struct, possibly with a typedef */
|
||||||
|
|
@ -3654,7 +3655,7 @@ cpp_class_decl : storage_class cpptype idcolon inherit LBRACE {
|
||||||
cparse_start_line = cparse_line;
|
cparse_start_line = cparse_line;
|
||||||
currentOuterClass = $<node>$;
|
currentOuterClass = $<node>$;
|
||||||
inclass = 1;
|
inclass = 1;
|
||||||
Classprefix = NewStringEmpty();
|
Classprefix = 0;
|
||||||
Delete(Namespaceprefix);
|
Delete(Namespaceprefix);
|
||||||
Namespaceprefix = Swig_symbol_qualifiedscopename(0);
|
Namespaceprefix = Swig_symbol_qualifiedscopename(0);
|
||||||
/* save the structure declaration to make a typedef for it later*/
|
/* save the structure declaration to make a typedef for it later*/
|
||||||
|
|
@ -3765,6 +3766,7 @@ cpp_class_decl : storage_class cpptype idcolon inherit LBRACE {
|
||||||
Delete($$);
|
Delete($$);
|
||||||
$$ = $6; /* pass member list to outer class/namespace (instead of self)*/
|
$$ = $6; /* pass member list to outer class/namespace (instead of self)*/
|
||||||
}
|
}
|
||||||
|
Classprefix = currentOuterClass ? Getattr(currentOuterClass, "Classprefix") : 0;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue