Commit 76d3b8f5 authored by Roberto Raggi's avatar Roberto Raggi

Process compound statements.

parent d993cdb3
...@@ -1036,12 +1036,14 @@ bool Bind::visit(CaseStatementAST *ast) ...@@ -1036,12 +1036,14 @@ bool Bind::visit(CaseStatementAST *ast)
bool Bind::visit(CompoundStatementAST *ast) bool Bind::visit(CompoundStatementAST *ast)
{ {
// unsigned lbrace_token = ast->lbrace_token; Block *block = control()->newBlock(ast->firstToken());
ast->symbol = block;
_scope->addMember(block);
Scope *previousScope = switchScope(block);
for (StatementListAST *it = ast->statement_list; it; it = it->next) { for (StatementListAST *it = ast->statement_list; it; it = it->next) {
this->statement(it->value); this->statement(it->value);
} }
// unsigned rbrace_token = ast->rbrace_token; (void) switchScope(previousScope);
// Block *symbol = ast->symbol;
return false; return false;
} }
...@@ -1708,10 +1710,13 @@ bool Bind::visit(FunctionDefinitionAST *ast) ...@@ -1708,10 +1710,13 @@ bool Bind::visit(FunctionDefinitionAST *ast)
this->ctorInitializer(ast->ctor_initializer, fun); this->ctorInitializer(ast->ctor_initializer, fun);
if (! _skipFunctionBodies) { if (! _skipFunctionBodies && ast->function_body) {
Scope *previousScope = switchScope(fun); Scope *previousScope = switchScope(fun);
this->statement(ast->function_body); this->statement(ast->function_body);
(void) switchScope(previousScope); (void) switchScope(previousScope);
if (CompoundStatementAST *c = ast->function_body->asCompoundStatement())
fun->setBlock(c->symbol);
} }
// Function *symbol = ast->symbol; // Function *symbol = ast->symbol;
......
Markdown is supported
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