Removed TemplateArgumentListAST

Done with Erik Verbruggen
This commit is contained in:
Roberto Raggi
2009-11-10 12:37:46 +01:00
parent 6e3e293e53
commit 8efb73f5d2
9 changed files with 13 additions and 55 deletions

View File

@@ -1504,22 +1504,6 @@ unsigned SwitchStatementAST::lastToken() const
return switch_token + 1;
}
unsigned TemplateArgumentListAST::firstToken() const
{
return template_argument->firstToken();
}
unsigned TemplateArgumentListAST::lastToken() const
{
for (const TemplateArgumentListAST *it = this; it; it = it->next) {
if (! it->next && it->template_argument)
return it->template_argument->lastToken();
}
return 0;
}
unsigned TemplateDeclarationAST::firstToken() const
{
if (export_token)
@@ -1561,8 +1545,8 @@ unsigned TemplateIdAST::lastToken() const
return greater_token + 1;
for (TemplateArgumentListAST *it = template_arguments; it; it = it->next) {
if (! it->next && it->template_argument)
return it->template_argument->lastToken();
if (! it->next && it->value)
return it->value->lastToken();
}
if (less_token)

View File

@@ -1851,22 +1851,6 @@ protected:
virtual void accept0(ASTVisitor *visitor);
};
class CPLUSPLUS_EXPORT TemplateArgumentListAST: public AST
{
public:
ExpressionAST *template_argument;
TemplateArgumentListAST *next;
public:
virtual TemplateArgumentListAST *asTemplateArgumentList() { return this; }
virtual unsigned firstToken() const;
virtual unsigned lastToken() const;
protected:
virtual void accept0(ASTVisitor *visitor);
};
class CPLUSPLUS_EXPORT TemplateDeclarationAST: public DeclarationAST
{
public:

View File

@@ -781,14 +781,6 @@ void SwitchStatementAST::accept0(ASTVisitor *visitor)
visitor->endVisit(this);
}
void TemplateArgumentListAST::accept0(ASTVisitor *visitor)
{
if (visitor->visit(this)) {
accept(template_argument, visitor);
}
visitor->endVisit(this);
}
void TemplateDeclarationAST::accept0(ASTVisitor *visitor)
{
if (visitor->visit(this)) {

View File

@@ -172,7 +172,6 @@ public:
virtual bool visit(SizeofExpressionAST *) { return true; }
virtual bool visit(StringLiteralAST *) { return true; }
virtual bool visit(SwitchStatementAST *) { return true; }
virtual bool visit(TemplateArgumentListAST *) { return true; }
virtual bool visit(TemplateDeclarationAST *) { return true; }
virtual bool visit(TemplateIdAST *) { return true; }
virtual bool visit(TemplateTypeParameterAST *) { return true; }
@@ -304,7 +303,6 @@ public:
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 *) { }

View File

@@ -179,7 +179,6 @@ class SpecifierAST;
class StatementAST;
class StringLiteralAST;
class SwitchStatementAST;
class TemplateArgumentListAST;
class TemplateDeclarationAST;
class TemplateIdAST;
class TemplateTypeParameterAST;
@@ -202,6 +201,7 @@ typedef List<ExpressionAST *> ExpressionListAST;
typedef List<DeclarationAST *> DeclarationListAST;
typedef List<StatementAST *> StatementListAST;
typedef List<DeclaratorAST *> DeclaratorListAST;
typedef ExpressionListAST TemplateArgumentListAST;
} // end of namespace CPlusPlus

View File

@@ -361,7 +361,7 @@ bool CheckName::visit(TemplateIdAST *ast)
std::vector<FullySpecifiedType> templateArguments;
for (TemplateArgumentListAST *it = ast->template_arguments; it;
it = it->next) {
ExpressionAST *arg = it->template_argument;
ExpressionAST *arg = it->value;
FullySpecifiedType exprTy = semantic()->check(arg, _scope);
templateArguments.push_back(exprTy);
}

View File

@@ -716,14 +716,14 @@ bool Parser::parseTemplateArgumentList(TemplateArgumentListAST *&node)
ExpressionAST *template_argument = 0;
if (parseTemplateArgument(template_argument)) {
*template_argument_ptr = new (_pool) TemplateArgumentListAST;
(*template_argument_ptr)->template_argument = template_argument;
(*template_argument_ptr)->value = template_argument;
template_argument_ptr = &(*template_argument_ptr)->next;
while (LA() == T_COMMA) {
consumeToken(); // consume T_COMMA
if (parseTemplateArgument(template_argument)) {
*template_argument_ptr = new (_pool) TemplateArgumentListAST;
(*template_argument_ptr)->template_argument = template_argument;
(*template_argument_ptr)->value = template_argument;
template_argument_ptr = &(*template_argument_ptr)->next;
}
}
@@ -3365,8 +3365,8 @@ bool Parser::parseNameId(NameAST *&name)
else if (LA() == T_LPAREN) {
// a template-id followed by a T_LPAREN
if (TemplateArgumentListAST *template_arguments = template_id->template_arguments) {
if (! template_arguments->next && template_arguments->template_argument &&
template_arguments->template_argument->asBinaryExpression()) {
if (! template_arguments->next && template_arguments->value &&
template_arguments->value->asBinaryExpression()) {
unsigned saved = cursor();
ExpressionAST *expr = 0;