Commit cd9e752a authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Introduced ASTVisitor::endVisit(ast node)

parent 7e5bb9cd
This diff is collapsed.
......@@ -573,6 +573,9 @@ public:
StatementAST *statements;
unsigned rbrace_token;
public: // annotations
Block *symbol;
public:
virtual unsigned firstToken() const;
virtual unsigned lastToken() const;
......@@ -966,6 +969,9 @@ public:
unsigned rparen_token;
StatementAST *statement;
public: // annotations
Block *symbol;
public:
virtual unsigned firstToken() const;
virtual unsigned lastToken() const;
......@@ -987,6 +993,9 @@ public:
unsigned else_token;
StatementAST *else_statement;
public: // annotations
Block *symbol;
public:
virtual unsigned firstToken() const;
virtual unsigned lastToken() const;
......@@ -1746,6 +1755,9 @@ public:
unsigned rparen_token;
StatementAST *statement;
public: // annotations
Block *symbol;
public:
virtual unsigned firstToken() const;
virtual unsigned lastToken() const;
......@@ -1850,6 +1862,9 @@ public:
StatementAST *statement;
CatchClauseAST *next;
public: // annotations
Block *symbol;
public:
virtual unsigned firstToken() const;
virtual unsigned lastToken() const;
......@@ -1989,6 +2004,9 @@ public:
unsigned rparen_token;
StatementAST *statement;
public: // annotations
Block *symbol;
public:
virtual unsigned firstToken() const;
virtual unsigned lastToken() const;
......
......@@ -190,6 +190,110 @@ public:
virtual bool visit(IdentifierListAST *) { return true; }
virtual bool visit(ObjCClassDeclarationAST *) { return true; }
virtual void endVisit(AccessDeclarationAST *) { }
virtual void endVisit(ArrayAccessAST *) { }
virtual void endVisit(ArrayDeclaratorAST *) { }
virtual void endVisit(ArrayInitializerAST *) { }
virtual void endVisit(AsmDefinitionAST *) { }
virtual void endVisit(AttributeSpecifierAST *) { }
virtual void endVisit(AttributeAST *) { }
virtual void endVisit(BaseSpecifierAST *) { }
virtual void endVisit(BinaryExpressionAST *) { }
virtual void endVisit(BoolLiteralAST *) { }
virtual void endVisit(BreakStatementAST *) { }
virtual void endVisit(CallAST *) { }
virtual void endVisit(CaseStatementAST *) { }
virtual void endVisit(CastExpressionAST *) { }
virtual void endVisit(CatchClauseAST *) { }
virtual void endVisit(ClassSpecifierAST *) { }
virtual void endVisit(CompoundLiteralAST *) { }
virtual void endVisit(CompoundStatementAST *) { }
virtual void endVisit(ConditionAST *) { }
virtual void endVisit(ConditionalExpressionAST *) { }
virtual void endVisit(ContinueStatementAST *) { }
virtual void endVisit(ConversionFunctionIdAST *) { }
virtual void endVisit(CppCastExpressionAST *) { }
virtual void endVisit(CtorInitializerAST *) { }
virtual void endVisit(DeclaratorAST *) { }
virtual void endVisit(DeclarationStatementAST *) { }
virtual void endVisit(DeclaratorIdAST *) { }
virtual void endVisit(DeclaratorListAST *) { }
virtual void endVisit(DeleteExpressionAST *) { }
virtual void endVisit(DestructorNameAST *) { }
virtual void endVisit(DoStatementAST *) { }
virtual void endVisit(ElaboratedTypeSpecifierAST *) { }
virtual void endVisit(EmptyDeclarationAST *) { }
virtual void endVisit(EnumSpecifierAST *) { }
virtual void endVisit(EnumeratorAST *) { }
virtual void endVisit(ExceptionDeclarationAST *) { }
virtual void endVisit(ExceptionSpecificationAST *) { }
virtual void endVisit(ExpressionListAST *) { }
virtual void endVisit(ExpressionOrDeclarationStatementAST *) { }
virtual void endVisit(ExpressionStatementAST *) { }
virtual void endVisit(ForStatementAST *) { }
virtual void endVisit(FunctionDeclaratorAST *) { }
virtual void endVisit(FunctionDefinitionAST *) { }
virtual void endVisit(GotoStatementAST *) { }
virtual void endVisit(IfStatementAST *) { }
virtual void endVisit(LabeledStatementAST *) { }
virtual void endVisit(LinkageBodyAST *) { }
virtual void endVisit(LinkageSpecificationAST *) { }
virtual void endVisit(MemInitializerAST *) { }
virtual void endVisit(MemberAccessAST *) { }
virtual void endVisit(NamedTypeSpecifierAST *) { }
virtual void endVisit(NamespaceAST *) { }
virtual void endVisit(NamespaceAliasDefinitionAST *) { }
virtual void endVisit(NestedDeclaratorAST *) { }
virtual void endVisit(NestedExpressionAST *) { }
virtual void endVisit(NestedNameSpecifierAST *) { }
virtual void endVisit(NewDeclaratorAST *) { }
virtual void endVisit(NewExpressionAST *) { }
virtual void endVisit(NewInitializerAST *) { }
virtual void endVisit(NewTypeIdAST *) { }
virtual void endVisit(NumericLiteralAST *) { }
virtual void endVisit(OperatorAST *) { }
virtual void endVisit(OperatorFunctionIdAST *) { }
virtual void endVisit(ParameterDeclarationAST *) { }
virtual void endVisit(ParameterDeclarationClauseAST *) { }
virtual void endVisit(PointerAST *) { }
virtual void endVisit(PointerToMemberAST *) { }
virtual void endVisit(PostIncrDecrAST *) { }
virtual void endVisit(PostfixExpressionAST *) { }
virtual void endVisit(QualifiedNameAST *) { }
virtual void endVisit(ReferenceAST *) { }
virtual void endVisit(ReturnStatementAST *) { }
virtual void endVisit(SimpleDeclarationAST *) { }
virtual void endVisit(SimpleNameAST *) { }
virtual void endVisit(SimpleSpecifierAST *) { }
virtual void endVisit(SizeofExpressionAST *) { }
virtual void endVisit(StringLiteralAST *) { }
virtual void endVisit(SwitchStatementAST *) { }
virtual void endVisit(TemplateArgumentListAST *) { }
virtual void endVisit(TemplateDeclarationAST *) { }
virtual void endVisit(TemplateIdAST *) { }
virtual void endVisit(TemplateTypeParameterAST *) { }
virtual void endVisit(ThisExpressionAST *) { }
virtual void endVisit(ThrowExpressionAST *) { }
virtual void endVisit(TranslationUnitAST *) { }
virtual void endVisit(TryBlockStatementAST *) { }
virtual void endVisit(TypeConstructorCallAST *) { }
virtual void endVisit(TypeIdAST *) { }
virtual void endVisit(TypeidExpressionAST *) { }
virtual void endVisit(TypeofSpecifierAST *) { }
virtual void endVisit(TypenameCallExpressionAST *) { }
virtual void endVisit(TypenameTypeParameterAST *) { }
virtual void endVisit(UnaryExpressionAST *) { }
virtual void endVisit(UsingAST *) { }
virtual void endVisit(UsingDirectiveAST *) { }
virtual void endVisit(WhileStatementAST *) { }
virtual void endVisit(QtMethodAST *) { }
// ObjC++
virtual void endVisit(IdentifierListAST *) { }
virtual void endVisit(ObjCClassDeclarationAST *) { }
private:
Control *_control;
};
......
......@@ -103,6 +103,7 @@ bool CheckStatement::visit(CaseStatementAST *ast)
bool CheckStatement::visit(CompoundStatementAST *ast)
{
Block *block = control()->newBlock(ast->lbrace_token);
ast->symbol = block;
_scope->enterSymbol(block);
Scope *previousScope = switchScope(block->members());
for (StatementAST *it = ast->statements; it; it = it->next) {
......@@ -145,6 +146,7 @@ bool CheckStatement::visit(ExpressionStatementAST *ast)
bool CheckStatement::visit(ForStatementAST *ast)
{
Block *block = control()->newBlock(ast->for_token);
ast->symbol = block;
_scope->enterSymbol(block);
Scope *previousScope = switchScope(block->members());
semantic()->check(ast->initializer, _scope);
......@@ -158,6 +160,7 @@ bool CheckStatement::visit(ForStatementAST *ast)
bool CheckStatement::visit(IfStatementAST *ast)
{
Block *block = control()->newBlock(ast->if_token);
ast->symbol = block;
_scope->enterSymbol(block);
Scope *previousScope = switchScope(block->members());
FullySpecifiedType exprTy = semantic()->check(ast->condition, _scope);
......@@ -197,6 +200,7 @@ bool CheckStatement::visit(ReturnStatementAST *ast)
bool CheckStatement::visit(SwitchStatementAST *ast)
{
Block *block = control()->newBlock(ast->switch_token);
ast->symbol = block;
_scope->enterSymbol(block);
Scope *previousScope = switchScope(block->members());
FullySpecifiedType condTy = semantic()->check(ast->condition, _scope);
......@@ -217,6 +221,7 @@ bool CheckStatement::visit(TryBlockStatementAST *ast)
bool CheckStatement::visit(CatchClauseAST *ast)
{
Block *block = control()->newBlock(ast->catch_token);
ast->symbol = block;
_scope->enterSymbol(block);
Scope *previousScope = switchScope(block->members());
semantic()->check(ast->exception_declaration, _scope);
......@@ -228,6 +233,7 @@ bool CheckStatement::visit(CatchClauseAST *ast)
bool CheckStatement::visit(WhileStatementAST *ast)
{
Block *block = control()->newBlock(ast->while_token);
ast->symbol = block;
_scope->enterSymbol(block);
Scope *previousScope = switchScope(block->members());
FullySpecifiedType condTy = semantic()->check(ast->condition, _scope);
......
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