Merge branch 'nested' of https://github.com/swig/swig into nested

This commit is contained in:
Vladimir Kalinin 2013-12-08 01:47:01 +04:00
commit cf3696e8f9
8 changed files with 58 additions and 59 deletions

View file

@ -309,9 +309,6 @@ static void add_symbols(Node *n) {
int isfriend = inclass && is_friend(n);
int iscdecl = Cmp(nodeType(n),"cdecl") == 0;
int only_csymbol = 0;
if (extendmode) {
Setattr(n,"isextension","1");
}
if (inclass) {
String *name = Getattr(n, "name");
@ -1594,6 +1591,7 @@ swig_directive : extend_directive { $$ = $1; }
extend_directive : EXTEND options idcolon LBRACE {
Node *cls;
String *clsname;
extendmode = 1;
cplus_mode = CPLUS_PUBLIC;
if (!classes) classes = NewHash();
if (!classes_typedefs) classes_typedefs = NewHash();
@ -1619,7 +1617,6 @@ extend_directive : EXTEND options idcolon LBRACE {
Note that %extend before the class typedef never worked, only %extend after the class typdef. */
prev_symtab = Swig_symbol_setscope(Getattr(cls, "symtab"));
current_class = cls;
extendmode = 1;
SWIG_WARN_NODE_BEGIN(cls);
Swig_warning(WARN_PARSE_EXTEND_NAME, cparse_file, cparse_line, "Deprecated %%extend name used - the %s name '%s' should be used instead of the typedef name '%s'.\n", Getattr(cls, "kind"), SwigType_namestr(Getattr(cls, "name")), $3);
SWIG_WARN_NODE_END(cls);
@ -1628,7 +1625,6 @@ extend_directive : EXTEND options idcolon LBRACE {
/* Previous class definition. Use its symbol table */
prev_symtab = Swig_symbol_setscope(Getattr(cls,"symtab"));
current_class = cls;
extendmode = 1;
}
Classprefix = NewString($3);
Namespaceprefix= Swig_symbol_qualifiedscopename(0);
@ -4286,7 +4282,7 @@ cpp_members : cpp_member cpp_members {
cpp_member : c_declaration { $$ = $1; }
| cpp_constructor_decl {
$$ = $1;
if (extendmode) {
if (extendmode && current_class) {
String *symname;
symname= make_name($$,Getattr($$,"name"), Getattr($$,"decl"));
if (Strcmp(symname,Getattr($$,"name")) == 0) {
@ -4327,7 +4323,7 @@ cpp_member : c_declaration { $$ = $1; }
*/
cpp_constructor_decl : storage_class type LPAREN parms RPAREN ctor_end {
if (Classprefix) {
if (inclass || extendmode) {
SwigType *decl = NewStringEmpty();
$$ = new_node("constructor");
Setattr($$,"storage",$1);