Commit 8efb73f5 authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Removed TemplateArgumentListAST

Done with Erik Verbruggen
parent 6e3e293e
......@@ -301,7 +301,7 @@ bool FindUsages::visit(QualifiedNameAST *ast)
if (template_id) {
for (TemplateArgumentListAST *template_arguments = template_id->template_arguments;
template_arguments; template_arguments = template_arguments->next) {
accept(template_arguments->template_argument);
accept(template_arguments->value);
}
}
}
......@@ -335,7 +335,7 @@ bool FindUsages::visit(QualifiedNameAST *ast)
for (TemplateArgumentListAST *template_arguments = template_id->template_arguments;
template_arguments; template_arguments = template_arguments->next) {
accept(template_arguments->template_argument);
accept(template_arguments->value);
}
}
}
......@@ -395,7 +395,7 @@ bool FindUsages::visit(TemplateIdAST *ast)
for (TemplateArgumentListAST *template_arguments = ast->template_arguments;
template_arguments; template_arguments = template_arguments->next) {
accept(template_arguments->template_argument);
accept(template_arguments->value);
}
return false;
......
......@@ -240,7 +240,7 @@ protected:
else if (TemplateIdAST *template_id = name->asTemplateId()) {
for (TemplateArgumentListAST *it = template_id->template_arguments; it; it = it->next) {
accept(it->template_argument);
accept(it->value);
}
}
}
......@@ -277,7 +277,7 @@ protected:
virtual bool visit(TemplateIdAST *ast)
{
for (TemplateArgumentListAST *arg = ast->template_arguments; arg; arg = arg->next)
accept(arg->template_argument);
accept(arg->value);
unsigned line, column;
getTokenStartPosition(ast->firstToken(), &line, &column);
......
......@@ -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)
......
......@@ -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:
......
......@@ -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)) {
......
......@@ -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 *) { }
......
......@@ -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
......
......@@ -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);
}
......
......@@ -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;
......
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