summaryrefslogtreecommitdiff
path: root/src/shared/cplusplus
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/cplusplus')
-rw-r--r--src/shared/cplusplus/AST.cpp20
-rw-r--r--src/shared/cplusplus/AST.h16
-rw-r--r--src/shared/cplusplus/ASTVisit.cpp8
-rw-r--r--src/shared/cplusplus/ASTVisitor.h2
-rw-r--r--src/shared/cplusplus/ASTfwd.h2
-rw-r--r--src/shared/cplusplus/CheckName.cpp2
-rw-r--r--src/shared/cplusplus/Parser.cpp8
7 files changed, 8 insertions, 50 deletions
diff --git a/src/shared/cplusplus/AST.cpp b/src/shared/cplusplus/AST.cpp
index db6a31fe2a..f47158ce40 100644
--- a/src/shared/cplusplus/AST.cpp
+++ b/src/shared/cplusplus/AST.cpp
@@ -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)
diff --git a/src/shared/cplusplus/AST.h b/src/shared/cplusplus/AST.h
index 04709031ad..10aa1a0c7b 100644
--- a/src/shared/cplusplus/AST.h
+++ b/src/shared/cplusplus/AST.h
@@ -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:
diff --git a/src/shared/cplusplus/ASTVisit.cpp b/src/shared/cplusplus/ASTVisit.cpp
index 605e1538de..f6b0bfb9b8 100644
--- a/src/shared/cplusplus/ASTVisit.cpp
+++ b/src/shared/cplusplus/ASTVisit.cpp
@@ -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)) {
diff --git a/src/shared/cplusplus/ASTVisitor.h b/src/shared/cplusplus/ASTVisitor.h
index 29703a44a7..ed61ea2a14 100644
--- a/src/shared/cplusplus/ASTVisitor.h
+++ b/src/shared/cplusplus/ASTVisitor.h
@@ -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 *) { }
diff --git a/src/shared/cplusplus/ASTfwd.h b/src/shared/cplusplus/ASTfwd.h
index 906e188891..50ab749ee5 100644
--- a/src/shared/cplusplus/ASTfwd.h
+++ b/src/shared/cplusplus/ASTfwd.h
@@ -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
diff --git a/src/shared/cplusplus/CheckName.cpp b/src/shared/cplusplus/CheckName.cpp
index 19e2eedf98..bcd8b3f180 100644
--- a/src/shared/cplusplus/CheckName.cpp
+++ b/src/shared/cplusplus/CheckName.cpp
@@ -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);
}
diff --git a/src/shared/cplusplus/Parser.cpp b/src/shared/cplusplus/Parser.cpp
index 6a4222024c..d52431e01c 100644
--- a/src/shared/cplusplus/Parser.cpp
+++ b/src/shared/cplusplus/Parser.cpp
@@ -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;