cppparser: fix scope bug in constructor inits

This also fixes the Android build.
This commit is contained in:
rdb 2017-05-25 13:20:11 +02:00
parent 828f1c10ca
commit d6657baf29
2 changed files with 3896 additions and 3864 deletions

File diff suppressed because it is too large Load Diff

View File

@ -928,12 +928,21 @@ type_like_declaration:
current_scope->add_declaration($2, global_scope, current_lexer, @2);
}
| storage_class constructor_prototype maybe_initialize_or_constructor_body
| storage_class constructor_prototype
{
if ($2 != (CPPInstance *)NULL) {
// Push the scope so that the initializers can make use of things defined
// in the class body.
push_scope($2->get_scope(current_scope, global_scope));
$2->_storage_class |= (current_storage_class | $1);
}
}
maybe_initialize_or_constructor_body
{
if ($2 != (CPPInstance *)NULL) {
pop_scope();
current_scope->add_declaration($2, global_scope, current_lexer, @2);
$2->set_initializer($3);
$2->set_initializer($4);
}
}
| storage_class function_prototype maybe_initialize_or_function_body