Commit 98a62c19 authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Push the function scope as soon as we're done processing the core-declarator.

parent 0f301f86
...@@ -345,7 +345,7 @@ bool FindUsages::visit(DeclaratorAST *ast) ...@@ -345,7 +345,7 @@ bool FindUsages::visit(DeclaratorAST *ast)
return false; return false;
} }
void FindUsages::declarator(DeclaratorAST *ast) void FindUsages::declarator(DeclaratorAST *ast, ScopedSymbol *symbol)
{ {
if (! ast) if (! ast)
return; return;
...@@ -356,6 +356,9 @@ void FindUsages::declarator(DeclaratorAST *ast) ...@@ -356,6 +356,9 @@ void FindUsages::declarator(DeclaratorAST *ast)
for (PtrOperatorListAST *it = ast->ptr_operator_list; it; it = it->next) { for (PtrOperatorListAST *it = ast->ptr_operator_list; it; it = it->next) {
this->ptrOperator(it->value); this->ptrOperator(it->value);
} }
Scope *previousScope = switchScope(symbol);
this->coreDeclarator(ast->core_declarator); this->coreDeclarator(ast->core_declarator);
for (PostfixDeclaratorListAST *it = ast->postfix_declarator_list; it; it = it->next) { for (PostfixDeclaratorListAST *it = ast->postfix_declarator_list; it; it = it->next) {
this->postfixDeclarator(it->value); this->postfixDeclarator(it->value);
...@@ -365,6 +368,7 @@ void FindUsages::declarator(DeclaratorAST *ast) ...@@ -365,6 +368,7 @@ void FindUsages::declarator(DeclaratorAST *ast)
} }
// unsigned equals_token = ast->equals_token; // unsigned equals_token = ast->equals_token;
this->expression(ast->initializer); this->expression(ast->initializer);
(void) switchScope(previousScope);
} }
bool FindUsages::visit(QtPropertyDeclarationItemAST *ast) bool FindUsages::visit(QtPropertyDeclarationItemAST *ast)
...@@ -1544,8 +1548,8 @@ bool FindUsages::visit(FunctionDefinitionAST *ast) ...@@ -1544,8 +1548,8 @@ bool FindUsages::visit(FunctionDefinitionAST *ast)
for (SpecifierListAST *it = ast->decl_specifier_list; it; it = it->next) { for (SpecifierListAST *it = ast->decl_specifier_list; it; it = it->next) {
this->specifier(it->value); this->specifier(it->value);
} }
Scope *previousScope = switchScope(ast->symbol); // ### not exactly. this->declarator(ast->declarator, ast->symbol);
this->declarator(ast->declarator); Scope *previousScope = switchScope(ast->symbol);
this->ctorInitializer(ast->ctor_initializer); this->ctorInitializer(ast->ctor_initializer);
this->statement(ast->function_body); this->statement(ast->function_body);
// Function *symbol = ast->symbol; // Function *symbol = ast->symbol;
......
...@@ -97,7 +97,7 @@ protected: ...@@ -97,7 +97,7 @@ protected:
void objCSelectorArgument(ObjCSelectorArgumentAST *ast); void objCSelectorArgument(ObjCSelectorArgumentAST *ast);
void attribute(AttributeAST *ast); void attribute(AttributeAST *ast);
void declarator(DeclaratorAST *ast); void declarator(DeclaratorAST *ast, ScopedSymbol *symbol = 0);
void qtPropertyDeclarationItem(QtPropertyDeclarationItemAST *ast); void qtPropertyDeclarationItem(QtPropertyDeclarationItemAST *ast);
void qtInterfaceName(QtInterfaceNameAST *ast); void qtInterfaceName(QtInterfaceNameAST *ast);
void baseSpecifier(BaseSpecifierAST *ast); void baseSpecifier(BaseSpecifierAST *ast);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment