Removed StatementListAST

Done with Erik Verbruggen
This commit is contained in:
Roberto Raggi
2009-11-10 11:27:56 +01:00
parent 36a0ea2bcb
commit 77e7899e7c
8 changed files with 14 additions and 56 deletions

View File

@@ -401,22 +401,6 @@ unsigned ClassSpecifierAST::lastToken() const
return classkey_token + 1;
}
unsigned StatementListAST::firstToken() const
{
return statement->firstToken();
}
unsigned StatementListAST::lastToken() const
{
for (const StatementListAST *it = this; it; it = it->next) {
if (! it->next)
return it->statement->lastToken();
}
return 0;
}
unsigned CompoundStatementAST::firstToken() const
{
return lbrace_token;
@@ -429,7 +413,7 @@ unsigned CompoundStatementAST::lastToken() const
for (StatementListAST *it = statements; it; it = it->next) {
if (! it->next)
return it->statement->lastToken();
return it->value->lastToken();
}
return lbrace_token + 1;

View File

@@ -607,22 +607,6 @@ protected:
virtual void accept0(ASTVisitor *visitor);
};
class CPLUSPLUS_EXPORT StatementListAST: public AST
{
public:
StatementAST *statement;
StatementListAST *next;
public:
virtual StatementListAST *asStatementList() { return this; }
virtual unsigned firstToken() const;
virtual unsigned lastToken() const;
protected:
virtual void accept0(ASTVisitor *visitor);
};
class CPLUSPLUS_EXPORT CompoundStatementAST: public StatementAST
{
public:

View File

@@ -180,14 +180,6 @@ void CaseStatementAST::accept0(ASTVisitor *visitor)
visitor->endVisit(this);
}
void StatementListAST::accept0(ASTVisitor *visitor)
{
if (visitor->visit(this)) {
accept(statement, visitor);
}
visitor->endVisit(this);
}
void CompoundStatementAST::accept0(ASTVisitor *visitor)
{
if (visitor->visit(this)) {

View File

@@ -171,7 +171,6 @@ public:
virtual bool visit(SimpleNameAST *) { return true; }
virtual bool visit(SimpleSpecifierAST *) { return true; }
virtual bool visit(SizeofExpressionAST *) { return true; }
virtual bool visit(StatementListAST *) { return true; }
virtual bool visit(StringLiteralAST *) { return true; }
virtual bool visit(SwitchStatementAST *) { return true; }
virtual bool visit(TemplateArgumentListAST *) { return true; }
@@ -305,7 +304,6 @@ public:
virtual void endVisit(SimpleNameAST *) { }
virtual void endVisit(SimpleSpecifierAST *) { }
virtual void endVisit(SizeofExpressionAST *) { }
virtual void endVisit(StatementListAST *) { }
virtual void endVisit(StringLiteralAST *) { }
virtual void endVisit(SwitchStatementAST *) { }
virtual void endVisit(TemplateArgumentListAST *) { }

View File

@@ -178,7 +178,6 @@ class SimpleSpecifierAST;
class SizeofExpressionAST;
class SpecifierAST;
class StatementAST;
class StatementListAST;
class StringLiteralAST;
class SwitchStatementAST;
class TemplateArgumentListAST;
@@ -202,6 +201,7 @@ class WhileStatementAST;
typedef List<ExpressionAST *> ExpressionListAST;
typedef List<DeclarationAST *> DeclarationListAST;
typedef List<StatementAST *> StatementListAST;
} // end of namespace CPlusPlus

View File

@@ -105,7 +105,7 @@ bool CheckStatement::visit(CompoundStatementAST *ast)
_scope->enterSymbol(block);
Scope *previousScope = switchScope(block->members());
for (StatementListAST *it = ast->statements; it; it = it->next) {
semantic()->check(it->statement, _scope);
semantic()->check(it->value, _scope);
}
(void) switchScope(previousScope);
return false;

View File

@@ -2439,7 +2439,7 @@ bool Parser::parseCompoundStatement(StatementAST *&node)
skipUntilStatement();
} else {
*statement_ptr = new (_pool) StatementListAST;
(*statement_ptr)->statement = statement;
(*statement_ptr)->value = statement;
statement_ptr = &(*statement_ptr)->next;
}
}