From 4c246763627cbc69b09ebe2ac1ea8be16669569f Mon Sep 17 00:00:00 2001
From: Roberto Raggi <roberto.raggi@nokia.com>
Date: Tue, 10 Nov 2009 12:48:33 +0100
Subject: [PATCH] Removed ObjCMessageArgumentDeclarationListAST Done with Erik
 Verbruggen

---
 src/shared/cplusplus/AST.cpp             | 22 ----------------------
 src/shared/cplusplus/AST.h               | 16 ----------------
 src/shared/cplusplus/ASTVisit.cpp        |  8 --------
 src/shared/cplusplus/ASTfwd.h            |  2 +-
 src/shared/cplusplus/CheckDeclarator.cpp |  2 +-
 src/shared/cplusplus/Parser.cpp          |  4 ++--
 6 files changed, 4 insertions(+), 50 deletions(-)

diff --git a/src/shared/cplusplus/AST.cpp b/src/shared/cplusplus/AST.cpp
index 4d7deaafd88..ccab8122b6f 100644
--- a/src/shared/cplusplus/AST.cpp
+++ b/src/shared/cplusplus/AST.cpp
@@ -2155,28 +2155,6 @@ unsigned ObjCMessageArgumentDeclarationAST::lastToken() const
     return 0;
 }
 
-unsigned ObjCMessageArgumentDeclarationListAST::firstToken() const
-{
-    if (argument_declaration)
-        return argument_declaration->firstToken();
-    else if (next)
-        return next->firstToken();
-    else
-        // ### Assert?
-        return 0;
-}
-
-unsigned ObjCMessageArgumentDeclarationListAST::lastToken() const
-{
-    for (const ObjCMessageArgumentDeclarationListAST *it = this; it; it = it->next) {
-        if (! it->next && it->argument_declaration) {
-            return it->argument_declaration->lastToken();
-        }
-    }
-    // ### assert?
-    return 0;
-}
-
 unsigned ObjCMethodPrototypeAST::firstToken() const
 {
     return method_type_token;
diff --git a/src/shared/cplusplus/AST.h b/src/shared/cplusplus/AST.h
index c46fca5a501..fc884741db9 100644
--- a/src/shared/cplusplus/AST.h
+++ b/src/shared/cplusplus/AST.h
@@ -2445,22 +2445,6 @@ protected:
     virtual void accept0(ASTVisitor *visitor);
 };
 
-class CPLUSPLUS_EXPORT ObjCMessageArgumentDeclarationListAST: public AST
-{
-public:
-    ObjCMessageArgumentDeclarationAST *argument_declaration;
-    ObjCMessageArgumentDeclarationListAST *next;
-
-public:
-    virtual ObjCMessageArgumentDeclarationListAST *asObjCMessageArgumentDeclarationList() { return this; }
-
-    virtual unsigned firstToken() const;
-    virtual unsigned lastToken() const;
-
-protected:
-    virtual void accept0(ASTVisitor *visitor);
-};
-
 class CPLUSPLUS_EXPORT ObjCMethodPrototypeAST: public AST
 {
 public:
diff --git a/src/shared/cplusplus/ASTVisit.cpp b/src/shared/cplusplus/ASTVisit.cpp
index ff1a76b5cf7..b6d18151973 100644
--- a/src/shared/cplusplus/ASTVisit.cpp
+++ b/src/shared/cplusplus/ASTVisit.cpp
@@ -1069,14 +1069,6 @@ void ObjCMessageArgumentDeclarationAST::accept0(ASTVisitor *visitor)
     visitor->endVisit(this);
 }
 
-void ObjCMessageArgumentDeclarationListAST::accept0(ASTVisitor *visitor)
-{
-    if (visitor->visit(this)) {
-        accept(argument_declaration, visitor);
-    }
-    visitor->endVisit(this);
-}
-
 void ObjCMethodPrototypeAST::accept0(ASTVisitor *visitor)
 {
     if (visitor->visit(this)) {
diff --git a/src/shared/cplusplus/ASTfwd.h b/src/shared/cplusplus/ASTfwd.h
index dc453748bed..7db518e87df 100644
--- a/src/shared/cplusplus/ASTfwd.h
+++ b/src/shared/cplusplus/ASTfwd.h
@@ -131,7 +131,6 @@ class ObjCFastEnumerationAST;
 class ObjCInstanceVariablesDeclarationAST;
 class ObjCMessageArgumentAST;
 class ObjCMessageArgumentDeclarationAST;
-class ObjCMessageArgumentDeclarationListAST;
 class ObjCMessageExpressionAST;
 class ObjCMethodDeclarationAST;
 class ObjCMethodPrototypeAST;
@@ -201,6 +200,7 @@ typedef List<NameAST *> ObjCIdentifierListAST;
 typedef List<ObjCMessageArgumentAST *> ObjCMessageArgumentListAST;
 typedef List<ObjCSelectorArgumentAST *> ObjCSelectorArgumentListAST;
 typedef List<ObjCPropertyAttributeAST *> ObjCPropertyAttributeListAST;
+typedef List<ObjCMessageArgumentDeclarationAST *> ObjCMessageArgumentDeclarationListAST;
 
 typedef ExpressionListAST TemplateArgumentListAST;
 
diff --git a/src/shared/cplusplus/CheckDeclarator.cpp b/src/shared/cplusplus/CheckDeclarator.cpp
index 6fd92458752..f89f796fe4e 100644
--- a/src/shared/cplusplus/CheckDeclarator.cpp
+++ b/src/shared/cplusplus/CheckDeclarator.cpp
@@ -267,7 +267,7 @@ bool CheckDeclarator::visit(ObjCMethodPrototypeAST *ast)
     if (ast->selector && ast->selector->asObjCSelectorWithArguments()) {
         // TODO: add arguments (EV)
         for (ObjCMessageArgumentDeclarationListAST *it = ast->arguments; it; it = it->next) {
-            ObjCMessageArgumentDeclarationAST *argDecl = it->argument_declaration;
+            ObjCMessageArgumentDeclarationAST *argDecl = it->value;
 
             semantic()->check(argDecl, method->arguments());
         }
diff --git a/src/shared/cplusplus/Parser.cpp b/src/shared/cplusplus/Parser.cpp
index 4f31a9e07db..cec6388eeef 100644
--- a/src/shared/cplusplus/Parser.cpp
+++ b/src/shared/cplusplus/Parser.cpp
@@ -4899,7 +4899,7 @@ bool Parser::parseObjCMethodPrototype(ObjCMethodPrototypeAST *&node)
         sel->selector_arguments->value = argument;
 
         ast->arguments = new (_pool) ObjCMessageArgumentDeclarationListAST;
-        ast->arguments->argument_declaration = declaration;
+        ast->arguments->value = declaration;
         ObjCMessageArgumentDeclarationListAST *lastArg = ast->arguments;
 
         while (parseObjCKeywordDeclaration(argument, declaration)) {
@@ -4909,7 +4909,7 @@ bool Parser::parseObjCMethodPrototype(ObjCMethodPrototypeAST *&node)
 
             lastArg->next = new (_pool) ObjCMessageArgumentDeclarationListAST;
             lastArg = lastArg->next;
-            lastArg->argument_declaration = declaration;
+            lastArg->value = declaration;
         }
 
         while (LA() == T_COMMA) {
-- 
GitLab