From e5c9aaab4b1c4ac709eab50dc043e3c69235ecf7 Mon Sep 17 00:00:00 2001 From: Roberto Raggi <roberto.raggi@nokia.com> Date: Tue, 10 Nov 2009 12:45:20 +0100 Subject: [PATCH] Removed ObjCSelectorArgumentListAST Done with Erik Verbruggen --- src/shared/cplusplus/AST.cpp | 19 ------------------- src/shared/cplusplus/AST.h | 16 ---------------- src/shared/cplusplus/ASTVisit.cpp | 8 -------- src/shared/cplusplus/ASTfwd.h | 2 +- src/shared/cplusplus/CheckName.cpp | 2 +- src/shared/cplusplus/Parser.cpp | 26 +++++++++++++------------- 6 files changed, 15 insertions(+), 58 deletions(-) diff --git a/src/shared/cplusplus/AST.cpp b/src/shared/cplusplus/AST.cpp index fe28c1d27d8..6aaf3527011 100644 --- a/src/shared/cplusplus/AST.cpp +++ b/src/shared/cplusplus/AST.cpp @@ -2047,25 +2047,6 @@ unsigned ObjCSelectorArgumentAST::lastToken() const return name_token + 1; } -unsigned ObjCSelectorArgumentListAST::firstToken() const -{ - if (argument) - return argument->firstToken(); - - // ### assert? - return 0; -} - -unsigned ObjCSelectorArgumentListAST::lastToken() const -{ - for (const ObjCSelectorArgumentListAST *it = this; it; it = it->next) - if (!it->next && it->argument) - return it->argument->lastToken(); - - // ### assert? - return 0; -} - unsigned ObjCSelectorWithArgumentsAST::firstToken() const { return selector_arguments->firstToken(); diff --git a/src/shared/cplusplus/AST.h b/src/shared/cplusplus/AST.h index 129c132f94c..6a0e4d96cc3 100644 --- a/src/shared/cplusplus/AST.h +++ b/src/shared/cplusplus/AST.h @@ -2323,22 +2323,6 @@ protected: virtual void accept0(ASTVisitor *visitor); }; -class CPLUSPLUS_EXPORT ObjCSelectorArgumentListAST: public AST -{ -public: - ObjCSelectorArgumentAST *argument; - ObjCSelectorArgumentListAST *next; - -public: - virtual ObjCSelectorArgumentListAST *asObjCSelectorArgumentList() { return this; } - - virtual unsigned firstToken() const; - virtual unsigned lastToken() const; - -protected: - virtual void accept0(ASTVisitor *visitor); -}; - class CPLUSPLUS_EXPORT ObjCSelectorWithArgumentsAST: public ObjCSelectorAST { public: diff --git a/src/shared/cplusplus/ASTVisit.cpp b/src/shared/cplusplus/ASTVisit.cpp index 2f60cdf4616..fe685c3111e 100644 --- a/src/shared/cplusplus/ASTVisit.cpp +++ b/src/shared/cplusplus/ASTVisit.cpp @@ -1006,14 +1006,6 @@ void ObjCSelectorArgumentAST::accept0(ASTVisitor *visitor) visitor->endVisit(this); } -void ObjCSelectorArgumentListAST::accept0(ASTVisitor *visitor) -{ - if (visitor->visit(this)) { - accept(argument, visitor); - } - visitor->endVisit(this); -} - void ObjCSelectorWithArgumentsAST::accept0(ASTVisitor *visitor) { if (visitor->visit(this)) { diff --git a/src/shared/cplusplus/ASTfwd.h b/src/shared/cplusplus/ASTfwd.h index 119758e63b5..a03eabc1cd1 100644 --- a/src/shared/cplusplus/ASTfwd.h +++ b/src/shared/cplusplus/ASTfwd.h @@ -144,7 +144,6 @@ class ObjCProtocolForwardDeclarationAST; class ObjCProtocolRefsAST; class ObjCSelectorAST; class ObjCSelectorArgumentAST; -class ObjCSelectorArgumentListAST; class ObjCSelectorExpressionAST; class ObjCSelectorWithArgumentsAST; class ObjCSelectorWithoutArgumentsAST; @@ -201,6 +200,7 @@ typedef List<StatementAST *> StatementListAST; typedef List<DeclaratorAST *> DeclaratorListAST; typedef List<NameAST *> ObjCIdentifierListAST; typedef List<ObjCMessageArgumentAST *> ObjCMessageArgumentListAST; +typedef List<ObjCSelectorArgumentAST *> ObjCSelectorArgumentListAST; typedef ExpressionListAST TemplateArgumentListAST; diff --git a/src/shared/cplusplus/CheckName.cpp b/src/shared/cplusplus/CheckName.cpp index bcd8b3f1806..4b1c62ff0e6 100644 --- a/src/shared/cplusplus/CheckName.cpp +++ b/src/shared/cplusplus/CheckName.cpp @@ -389,7 +389,7 @@ bool CheckName::visit(ObjCSelectorWithArgumentsAST *ast) { std::vector<Name *> names; for (ObjCSelectorArgumentListAST *it = ast->selector_arguments; it; it = it->next) { - Identifier *id = identifier(it->argument->name_token); + Identifier *id = identifier(it->value->name_token); Name *name = control()->nameId(id); names.push_back(name); diff --git a/src/shared/cplusplus/Parser.cpp b/src/shared/cplusplus/Parser.cpp index 06a938763a6..a1536608f68 100644 --- a/src/shared/cplusplus/Parser.cpp +++ b/src/shared/cplusplus/Parser.cpp @@ -3180,16 +3180,16 @@ bool Parser::parseObjCSelectorExpression(ExpressionAST *&node) ast->selector = args; ObjCSelectorArgumentListAST *last = new (_pool) ObjCSelectorArgumentListAST; args->selector_arguments = last; - last->argument = new (_pool) ObjCSelectorArgumentAST; - last->argument->name_token = identifier_token; - last->argument->colon_token = consumeToken(); + last->value = new (_pool) ObjCSelectorArgumentAST; + last->value->name_token = identifier_token; + last->value->colon_token = consumeToken(); while (LA() != T_RPAREN) { last->next = new (_pool) ObjCSelectorArgumentListAST; last = last->next; - last->argument = new (_pool) ObjCSelectorArgumentAST; - match(T_IDENTIFIER, &(last->argument->name_token)); - match(T_COLON, &(last->argument->colon_token)); + last->value = new (_pool) ObjCSelectorArgumentAST; + match(T_IDENTIFIER, &(last->value->name_token)); + match(T_COLON, &(last->value->colon_token)); } } else { ObjCSelectorWithoutArgumentsAST *args = new (_pool) ObjCSelectorWithoutArgumentsAST; @@ -3253,7 +3253,7 @@ bool Parser::parseObjCMessageArguments(ObjCSelectorAST *&selNode, ObjCMessageArg if (parseObjCSelectorArg(selectorArgument, messageArgument)) { ObjCSelectorArgumentListAST *selAst = new (_pool) ObjCSelectorArgumentListAST; - selAst->argument = selectorArgument; + selAst->value = selectorArgument; ObjCSelectorArgumentListAST *lastSelector = selAst; ObjCMessageArgumentListAST *argAst = new (_pool) ObjCMessageArgumentListAST; @@ -3264,7 +3264,7 @@ bool Parser::parseObjCMessageArguments(ObjCSelectorAST *&selNode, ObjCMessageArg // accept the selector args. lastSelector->next = new (_pool) ObjCSelectorArgumentListAST; lastSelector = lastSelector->next; - lastSelector->argument = selectorArgument; + lastSelector->value = selectorArgument; lastArgument->next = new (_pool) ObjCMessageArgumentListAST; lastArgument = lastArgument->next; @@ -4896,7 +4896,7 @@ bool Parser::parseObjCMethodPrototype(ObjCMethodPrototypeAST *&node) ast->selector = sel; ObjCSelectorArgumentListAST *lastSel = new (_pool) ObjCSelectorArgumentListAST; sel->selector_arguments = lastSel; - sel->selector_arguments->argument = argument; + sel->selector_arguments->value = argument; ast->arguments = new (_pool) ObjCMessageArgumentDeclarationListAST; ast->arguments->argument_declaration = declaration; @@ -4905,7 +4905,7 @@ bool Parser::parseObjCMethodPrototype(ObjCMethodPrototypeAST *&node) while (parseObjCKeywordDeclaration(argument, declaration)) { lastSel->next = new (_pool) ObjCSelectorArgumentListAST; lastSel = lastSel->next; - lastSel->argument = argument; + lastSel->value = argument; lastArg->next = new (_pool) ObjCMessageArgumentDeclarationListAST; lastArg = lastArg->next; @@ -4982,9 +4982,9 @@ bool Parser::parseObjCPropertyAttribute(ObjCPropertyAttributeAST *&node) match(T_EQUAL, &(node->equals_token)); ObjCSelectorWithArgumentsAST *selector = new (_pool) ObjCSelectorWithArgumentsAST; selector->selector_arguments = new (_pool) ObjCSelectorArgumentListAST; - selector->selector_arguments->argument = new (_pool) ObjCSelectorArgumentAST; - match(T_IDENTIFIER, &(selector->selector_arguments->argument->name_token)); - match(T_COLON, &(selector->selector_arguments->argument->colon_token)); + selector->selector_arguments->value = new (_pool) ObjCSelectorArgumentAST; + match(T_IDENTIFIER, &(selector->selector_arguments->value->name_token)); + match(T_COLON, &(selector->selector_arguments->value->colon_token)); node->method_selector = selector; return true; } -- GitLab