From 4089c906fa0fb2988e73c23d8eeb5a15d8b8629f Mon Sep 17 00:00:00 2001
From: Roberto Raggi <roberto.raggi@nokia.com>
Date: Tue, 10 Nov 2009 11:13:57 +0100
Subject: [PATCH] Removed the ExpressionListAST node.

Done with Erik Verbruggen
---
 src/libs/cplusplus/CheckUndefinedSymbols.cpp | 11 +---
 src/libs/cplusplus/ResolveExpression.cpp     |  6 --
 src/libs/cplusplus/ResolveExpression.h       |  1 -
 src/shared/cplusplus/AST.cpp                 | 58 +++++-------------
 src/shared/cplusplus/AST.h                   | 64 +++++++++-----------
 src/shared/cplusplus/ASTVisit.cpp            |  8 ---
 src/shared/cplusplus/ASTVisitor.h            |  2 -
 src/shared/cplusplus/ASTfwd.h                |  6 +-
 src/shared/cplusplus/CheckExpression.cpp     | 18 ++----
 src/shared/cplusplus/CheckExpression.h       |  1 -
 src/shared/cplusplus/Parser.cpp              | 61 ++++++++-----------
 11 files changed, 82 insertions(+), 154 deletions(-)

diff --git a/src/libs/cplusplus/CheckUndefinedSymbols.cpp b/src/libs/cplusplus/CheckUndefinedSymbols.cpp
index 5f0b6b2d27d..6262dcebaac 100644
--- a/src/libs/cplusplus/CheckUndefinedSymbols.cpp
+++ b/src/libs/cplusplus/CheckUndefinedSymbols.cpp
@@ -380,15 +380,8 @@ bool CheckUndefinedSymbols::visit(BaseSpecifierAST *base)
                 resolvedBaseClassName = true;
         }
 
-        if (! resolvedBaseClassName) {
-            const char *token = "after `:'";
-
-            if (base->comma_token)
-                token = "after `,'";
-
-            translationUnit()->warning(nameAST->firstToken(),
-                                       "expected class-name %s token", token);
-        }
+        if (! resolvedBaseClassName)
+            translationUnit()->warning(nameAST->firstToken(), "expected class-name");
     }
 
     return true;
diff --git a/src/libs/cplusplus/ResolveExpression.cpp b/src/libs/cplusplus/ResolveExpression.cpp
index 9333d064e91..5999c9531de 100644
--- a/src/libs/cplusplus/ResolveExpression.cpp
+++ b/src/libs/cplusplus/ResolveExpression.cpp
@@ -118,12 +118,6 @@ void ResolveExpression::addResult(const Result &r)
 QList<Scope *> ResolveExpression::visibleScopes(const Result &result) const
 { return _context.visibleScopes(result); }
 
-bool ResolveExpression::visit(ExpressionListAST *)
-{
-    // nothing to do.
-    return false;
-}
-
 bool ResolveExpression::visit(BinaryExpressionAST *ast)
 {
     accept(ast->left_expression);
diff --git a/src/libs/cplusplus/ResolveExpression.h b/src/libs/cplusplus/ResolveExpression.h
index 0e0b637c228..34541e9f45e 100644
--- a/src/libs/cplusplus/ResolveExpression.h
+++ b/src/libs/cplusplus/ResolveExpression.h
@@ -72,7 +72,6 @@ protected:
 
     using ASTVisitor::visit;
 
-    virtual bool visit(ExpressionListAST *ast);
     virtual bool visit(BinaryExpressionAST *ast);
     virtual bool visit(CastExpressionAST *ast);
     virtual bool visit(ConditionAST *ast);
diff --git a/src/shared/cplusplus/AST.cpp b/src/shared/cplusplus/AST.cpp
index babf8380c5b..18357aee9d6 100644
--- a/src/shared/cplusplus/AST.cpp
+++ b/src/shared/cplusplus/AST.cpp
@@ -100,10 +100,9 @@ unsigned AttributeAST::lastToken() const
     if (rparen_token)
         return rparen_token + 1;
 
-    for (ExpressionListAST *it = expression_list;
-            it->expression && it->next; it = it->next) {
-        if (! it->next && it->expression) {
-            return it->expression->lastToken();
+    for (ExpressionListAST *it = expression_list; it->value && it->next; it = it->next) {
+        if (! it->next && it->value) {
+            return it->value->lastToken();
         }
     }
 
@@ -174,8 +173,8 @@ unsigned ArrayInitializerAST::lastToken() const
         return rbrace_token + 1;
 
     for (ExpressionListAST *it = expression_list; it; it = it->next) {
-        if (! it->next && it->expression)
-            return it->expression->lastToken();
+        if (! it->next && it->value)
+            return it->value->lastToken();
     }
 
     return lbrace_token + 1;
@@ -304,8 +303,8 @@ unsigned CallAST::lastToken() const
     if (rparen_token)
         return rparen_token + 1;
     for (ExpressionListAST *it = expression_list; it; it = it->next) {
-        if (! it->next && it->expression)
-            return it->expression->lastToken();
+        if (! it->next && it->value)
+            return it->value->lastToken();
     }
     return lparen_token + 1;
 }
@@ -643,9 +642,6 @@ unsigned DeclaratorIdAST::lastToken() const
 
 unsigned DeclaratorListAST::firstToken() const
 {
-    if (comma_token)
-        return comma_token;
-
     return declarator->firstToken();
 }
 
@@ -655,8 +651,6 @@ unsigned DeclaratorListAST::lastToken() const
         if (! it->next) {
             if (it->declarator)
                 return it->declarator->lastToken();
-            else if (it->comma_token)
-                return it->comma_token + 1;
         }
     }
 
@@ -818,8 +812,8 @@ unsigned ExceptionSpecificationAST::lastToken() const
         return rparen_token + 1;
 
     for (ExpressionListAST *it = type_ids; it; it = it->next) {
-        if (! it->next && it->expression)
-            return it->expression->lastToken();
+        if (! it->next && it->value)
+            return it->value->lastToken();
     }
 
     if (dot_dot_dot_token)
@@ -830,22 +824,6 @@ unsigned ExceptionSpecificationAST::lastToken() const
     return throw_token + 1;
 }
 
-
-unsigned ExpressionListAST::firstToken() const
-{
-    return expression->firstToken();
-}
-
-unsigned ExpressionListAST::lastToken() const
-{
-    for (const ExpressionListAST *it = this; it; it = it->next) {
-        if (! it->next)
-            return it->expression->lastToken();
-    }
-    return 0;
-}
-
-
 unsigned ExpressionOrDeclarationStatementAST::firstToken() const
 {
     return declaration->firstToken();
@@ -1908,8 +1886,8 @@ unsigned IdentifierListAST::firstToken() const
 {
     if (name)
         return name->firstToken();
-    else
-        return comma_token;
+    // ### assert?
+    return 0;
 }
 
 unsigned IdentifierListAST::lastToken() const
@@ -2264,8 +2242,6 @@ unsigned ObjCPropertyAttributeListAST::firstToken() const
 {
     if (attr)
         return attr->firstToken();
-    else if (comma_token)
-        return comma_token;
     else if (next)
         return next->lastToken();
     else
@@ -2276,12 +2252,8 @@ unsigned ObjCPropertyAttributeListAST::firstToken() const
 unsigned ObjCPropertyAttributeListAST::lastToken() const
 {
     for (const ObjCPropertyAttributeListAST *it = this; it; it = it->next) {
-        if (! it->next && (comma_token || it->attr)) {
-            if (comma_token)
-                return comma_token + 1;
-            else
-                return it->attr->lastToken();
-        }
+        if (! it->next && it->attr)
+            return it->attr->lastToken();
     }
     // ### assert?
     return 0;
@@ -2407,8 +2379,8 @@ unsigned ObjCSynthesizedPropertyListAST::firstToken() const
 {
     if (synthesized_property)
         return synthesized_property->firstToken();
-    else
-        return comma_token;
+    // ### assert?
+    return 0;
 }
 
 unsigned ObjCSynthesizedPropertyListAST::lastToken() const
diff --git a/src/shared/cplusplus/AST.h b/src/shared/cplusplus/AST.h
index 5d26bf1e54a..e10ce1b57ae 100644
--- a/src/shared/cplusplus/AST.h
+++ b/src/shared/cplusplus/AST.h
@@ -53,11 +53,10 @@
 #include "ASTfwd.h"
 #include "MemoryPool.h"
 
-
 namespace CPlusPlus {
 
 template <typename _Tp>
-class List: public Managed
+class CPLUSPLUS_EXPORT List: public Managed
 {
     List(const List &other);
     void operator =(const List &other);
@@ -67,6 +66,28 @@ public:
         : value(_Tp()), next(0)
     { }
 
+    unsigned firstToken() const
+    {
+        if (value)
+            return value->firstToken();
+
+        // ### assert(0);
+        return 0;
+    }
+
+    unsigned lastToken() const
+    {
+        unsigned token = 0;
+
+        for (const List *it = this; it; it = it->next) {
+            if (it->value)
+                token = it->value->lastToken();
+        }
+
+        // assert(token != 0);
+        return token;
+    }
+
     _Tp value;
     List *next;
 };
@@ -85,6 +106,13 @@ public:
     static void accept(AST *ast, ASTVisitor *visitor)
     { if (ast) ast->accept(visitor); }
 
+    template <typename _Tp>
+    static void accept(List<_Tp> *it, ASTVisitor *visitor)
+    {
+        for (; it; it = it->next)
+            accept(it->value, visitor);
+    }
+
     virtual unsigned firstToken() const = 0;
     virtual unsigned lastToken() const = 0;
 
@@ -129,7 +157,6 @@ public:
     virtual ExceptionDeclarationAST *asExceptionDeclaration() { return 0; }
     virtual ExceptionSpecificationAST *asExceptionSpecification() { return 0; }
     virtual ExpressionAST *asExpression() { return 0; }
-    virtual ExpressionListAST *asExpressionList() { return 0; }
     virtual ExpressionOrDeclarationStatementAST *asExpressionOrDeclarationStatement() { return 0; }
     virtual ExpressionStatementAST *asExpressionStatement() { return 0; }
     virtual ForStatementAST *asForStatement() { return 0; }
@@ -288,7 +315,6 @@ public:
     ExpressionListAST *expression_list;
     unsigned rparen_token;
     AttributeAST *next;
-    unsigned comma_token;
 
 public:
     virtual AttributeAST *asAttribute() { return this; }
@@ -322,21 +348,18 @@ class CPLUSPLUS_EXPORT StatementAST: public AST
 {
 public:
     virtual StatementAST *asStatement() { return this; }
-
 };
 
 class CPLUSPLUS_EXPORT ExpressionAST: public AST
 {
 public:
     virtual ExpressionAST *asExpression() { return this; }
-
 };
 
 class CPLUSPLUS_EXPORT DeclarationAST: public AST
 {
 public:
     virtual DeclarationAST *asDeclaration() { return this; }
-
 };
 
 class CPLUSPLUS_EXPORT DeclarationListAST: public AST
@@ -359,7 +382,6 @@ class CPLUSPLUS_EXPORT CoreDeclaratorAST: public AST
 {
 public:
     virtual CoreDeclaratorAST *asCoreDeclarator() { return this; }
-
 };
 
 class CPLUSPLUS_EXPORT PostfixDeclaratorAST: public AST
@@ -369,7 +391,6 @@ public:
 
 public:
     virtual PostfixDeclaratorAST *asPostfixDeclarator() { return this; }
-
 };
 
 class CPLUSPLUS_EXPORT DeclaratorAST: public AST
@@ -393,23 +414,6 @@ protected:
     virtual void accept0(ASTVisitor *visitor);
 };
 
-class CPLUSPLUS_EXPORT ExpressionListAST: public AST
-{
-public:
-    unsigned comma_token;
-    ExpressionAST *expression;
-    ExpressionListAST *next;
-
-public:
-    virtual ExpressionListAST *asExpressionList() { return this; }
-
-    virtual unsigned firstToken() const;
-    virtual unsigned lastToken() const;
-
-protected:
-    virtual void accept0(ASTVisitor *visitor);
-};
-
 class CPLUSPLUS_EXPORT SimpleDeclarationAST: public DeclarationAST
 {
 public:
@@ -487,7 +491,6 @@ protected:
 class CPLUSPLUS_EXPORT BaseSpecifierAST: public AST
 {
 public:
-    unsigned comma_token;
     unsigned virtual_token;
     unsigned access_specifier_token;
     NameAST *name;
@@ -818,7 +821,6 @@ protected:
 class CPLUSPLUS_EXPORT DeclaratorListAST: public AST
 {
 public:
-    unsigned comma_token;
     DeclaratorAST *declarator;
     DeclaratorListAST *next;
 
@@ -925,7 +927,6 @@ protected:
 class CPLUSPLUS_EXPORT EnumeratorAST: public AST
 {
 public:
-    unsigned comma_token;
     unsigned identifier_token;
     unsigned equal_token;
     ExpressionAST *expression;
@@ -1178,7 +1179,6 @@ protected:
 class CPLUSPLUS_EXPORT MemInitializerAST: public AST
 {
 public:
-    unsigned comma_token;
     NameAST *name;
     unsigned lparen_token;
     ExpressionAST *expression;
@@ -1902,7 +1902,6 @@ protected:
 class CPLUSPLUS_EXPORT TemplateArgumentListAST: public AST
 {
 public:
-    unsigned comma_token;
     ExpressionAST *template_argument;
     TemplateArgumentListAST *next;
 
@@ -2155,7 +2154,6 @@ class CPLUSPLUS_EXPORT IdentifierListAST: public AST
 {
 public:
     NameAST *name;
-    unsigned comma_token;
     IdentifierListAST *next;
 
 public:
@@ -2525,7 +2523,6 @@ class CPLUSPLUS_EXPORT ObjCPropertyAttributeListAST: public AST
 {
 public:
     ObjCPropertyAttributeAST *attr;
-    unsigned comma_token;
     ObjCPropertyAttributeListAST *next;
 
 public:
@@ -2655,7 +2652,6 @@ class CPLUSPLUS_EXPORT ObjCSynthesizedPropertyListAST: public AST
 {
 public:
     ObjCSynthesizedPropertyAST *synthesized_property;
-    unsigned comma_token;
     ObjCSynthesizedPropertyListAST *next;
 
 public:
diff --git a/src/shared/cplusplus/ASTVisit.cpp b/src/shared/cplusplus/ASTVisit.cpp
index dbc526c9e9d..7a9f9164d23 100644
--- a/src/shared/cplusplus/ASTVisit.cpp
+++ b/src/shared/cplusplus/ASTVisit.cpp
@@ -90,14 +90,6 @@ void DeclaratorAST::accept0(ASTVisitor *visitor)
     visitor->endVisit(this);
 }
 
-void ExpressionListAST::accept0(ASTVisitor *visitor)
-{
-    if (visitor->visit(this)) {
-        accept(expression, visitor);
-    }
-    visitor->endVisit(this);
-}
-
 void SimpleDeclarationAST::accept0(ASTVisitor *visitor)
 {
     if (visitor->visit(this)) {
diff --git a/src/shared/cplusplus/ASTVisitor.h b/src/shared/cplusplus/ASTVisitor.h
index 7356e0f9056..a5281cb50d3 100644
--- a/src/shared/cplusplus/ASTVisitor.h
+++ b/src/shared/cplusplus/ASTVisitor.h
@@ -131,7 +131,6 @@ public:
     virtual bool visit(EnumeratorAST *) { return true; }
     virtual bool visit(ExceptionDeclarationAST *) { return true; }
     virtual bool visit(ExceptionSpecificationAST *) { return true; }
-    virtual bool visit(ExpressionListAST *) { return true; }
     virtual bool visit(ExpressionOrDeclarationStatementAST *) { return true; }
     virtual bool visit(ExpressionStatementAST *) { return true; }
     virtual bool visit(ForeachStatementAST *) { return true; }
@@ -269,7 +268,6 @@ public:
     virtual void endVisit(EnumeratorAST *) { }
     virtual void endVisit(ExceptionDeclarationAST *) { }
     virtual void endVisit(ExceptionSpecificationAST *) { }
-    virtual void endVisit(ExpressionListAST *) { }
     virtual void endVisit(ExpressionOrDeclarationStatementAST *) { }
     virtual void endVisit(ExpressionStatementAST *) { }
     virtual void endVisit(ForeachStatementAST *) { }
diff --git a/src/shared/cplusplus/ASTfwd.h b/src/shared/cplusplus/ASTfwd.h
index 8703e512e15..1e0cf11ae36 100644
--- a/src/shared/cplusplus/ASTfwd.h
+++ b/src/shared/cplusplus/ASTfwd.h
@@ -53,6 +53,8 @@
 
 namespace CPlusPlus {
 
+template <typename _Tp> class List;
+
 class AST;
 class ASTVisitor;
 
@@ -97,7 +99,6 @@ class EnumeratorAST;
 class ExceptionDeclarationAST;
 class ExceptionSpecificationAST;
 class ExpressionAST;
-class ExpressionListAST;
 class ExpressionOrDeclarationStatementAST;
 class ExpressionStatementAST;
 class ForStatementAST;
@@ -200,6 +201,9 @@ class UsingAST;
 class UsingDirectiveAST;
 class WhileStatementAST;
 
+typedef List<ExpressionAST *> ExpressionListAST;
+
+
 } // end of namespace CPlusPlus
 
 
diff --git a/src/shared/cplusplus/CheckExpression.cpp b/src/shared/cplusplus/CheckExpression.cpp
index 02263d6b828..3703577ed0e 100644
--- a/src/shared/cplusplus/CheckExpression.cpp
+++ b/src/shared/cplusplus/CheckExpression.cpp
@@ -100,14 +100,6 @@ Scope *CheckExpression::switchScope(Scope *scope)
     return previousScope;
 }
 
-bool CheckExpression::visit(ExpressionListAST *ast)
-{
-    for (ExpressionListAST *it = ast; it; it = it->next) {
-        FullySpecifiedType exprTy = semantic()->check(it->expression, _scope);
-    }
-    return false;
-}
-
 bool CheckExpression::visit(BinaryExpressionAST *ast)
 {
     FullySpecifiedType leftExprTy = semantic()->check(ast->left_expression, _scope);
@@ -161,7 +153,7 @@ bool CheckExpression::visit(DeleteExpressionAST *ast)
 bool CheckExpression::visit(ArrayInitializerAST *ast)
 {
     for (ExpressionListAST *it = ast->expression_list; it; it = it->next) {
-        FullySpecifiedType exprTy = semantic()->check(it->expression, _scope);
+        FullySpecifiedType exprTy = semantic()->check(it->value, _scope);
     }
     return false;
 }
@@ -206,7 +198,7 @@ bool CheckExpression::visit(NewExpressionAST *ast)
 {
     if (ast->new_placement) {
         for (ExpressionListAST *it = ast->new_placement->expression_list; it; it = it->next) {
-            FullySpecifiedType exprTy = semantic()->check(it->expression, _scope);
+            FullySpecifiedType exprTy = semantic()->check(it->value, _scope);
         }
     }
 
@@ -239,7 +231,7 @@ bool CheckExpression::visit(TypenameCallExpressionAST *ast)
     (void) semantic()->check(ast->name, _scope);
 
     for (ExpressionListAST *it = ast->expression_list; it; it = it->next) {
-        FullySpecifiedType exprTy = semantic()->check(it->expression, _scope);
+        FullySpecifiedType exprTy = semantic()->check(it->value, _scope);
         (void) exprTy;
     }
     return false;
@@ -249,7 +241,7 @@ bool CheckExpression::visit(TypeConstructorCallAST *ast)
 {
     FullySpecifiedType typeSpecTy = semantic()->check(ast->type_specifier, _scope);
     for (ExpressionListAST *it = ast->expression_list; it; it = it->next) {
-        FullySpecifiedType exprTy = semantic()->check(it->expression, _scope);
+        FullySpecifiedType exprTy = semantic()->check(it->value, _scope);
     }
     return false;
 }
@@ -350,7 +342,7 @@ bool CheckExpression::visit(CompoundLiteralAST *ast)
 bool CheckExpression::visit(CallAST *ast)
 {
     for (ExpressionListAST *it = ast->expression_list; it; it = it->next) {
-        FullySpecifiedType exprTy = semantic()->check(it->expression, _scope);
+        FullySpecifiedType exprTy = semantic()->check(it->value, _scope);
     }
     return false;
 }
diff --git a/src/shared/cplusplus/CheckExpression.h b/src/shared/cplusplus/CheckExpression.h
index a61371db43f..2ef3a629038 100644
--- a/src/shared/cplusplus/CheckExpression.h
+++ b/src/shared/cplusplus/CheckExpression.h
@@ -71,7 +71,6 @@ protected:
 
     using ASTVisitor::visit;
 
-    virtual bool visit(ExpressionListAST *ast);
     virtual bool visit(BinaryExpressionAST *ast);
     virtual bool visit(CastExpressionAST *ast);
     virtual bool visit(ConditionAST *ast);
diff --git a/src/shared/cplusplus/Parser.cpp b/src/shared/cplusplus/Parser.cpp
index ca26cb629e3..f86ee1a976d 100644
--- a/src/shared/cplusplus/Parser.cpp
+++ b/src/shared/cplusplus/Parser.cpp
@@ -719,11 +719,10 @@ bool Parser::parseTemplateArgumentList(TemplateArgumentListAST *&node)
         (*template_argument_ptr)->template_argument = template_argument;
         template_argument_ptr = &(*template_argument_ptr)->next;
         while (LA() == T_COMMA) {
-            unsigned comma_token = consumeToken();
+            consumeToken(); // consume T_COMMA
 
             if (parseTemplateArgument(template_argument)) {
                 *template_argument_ptr = new (_pool) TemplateArgumentListAST;
-                (*template_argument_ptr)->comma_token = comma_token;
                 (*template_argument_ptr)->template_argument = template_argument;
                 template_argument_ptr = &(*template_argument_ptr)->next;
             }
@@ -1320,7 +1319,6 @@ bool Parser::parseEnumSpecifier(SpecifierAST *&node)
                 }
 
                 if (parseEnumerator(*enumerator_ptr)) {
-                    (*enumerator_ptr)->comma_token = comma_token;
                     enumerator_ptr = &(*enumerator_ptr)->next;
                 }
 
@@ -1791,12 +1789,10 @@ bool Parser::parseBaseClause(BaseSpecifierAST *&node)
             ast = &(*ast)->next;
 
             while (LA() == T_COMMA) {
-                unsigned comma_token = consumeToken();
+                consumeToken(); // consume T_COMMA
 
-                if (parseBaseSpecifier(*ast)) {
-                    (*ast)->comma_token = comma_token;
+                if (parseBaseSpecifier(*ast))
                     ast = &(*ast)->next;
-                }
             }
         }
 
@@ -1825,12 +1821,10 @@ bool Parser::parseMemInitializerList(MemInitializerAST *&node)
     if (parseMemInitializer(*initializer)) {
         initializer = &(*initializer)->next;
         while (LA() == T_COMMA) {
-            unsigned comma_token = consumeToken();
+            consumeToken(); // consume T_COMMA
 
-            if (parseMemInitializer(*initializer)) {
-                (*initializer)->comma_token = comma_token;
+            if (parseMemInitializer(*initializer))
                 initializer = &(*initializer)->next;
-            }
         }
         return true;
     }
@@ -1861,14 +1855,14 @@ bool Parser::parseTypeIdList(ExpressionListAST *&node)
     ExpressionAST *typeId = 0;
     if (parseTypeId(typeId)) {
         *expression_list_ptr = new (_pool) ExpressionListAST;
-        (*expression_list_ptr)->expression = typeId;
+        (*expression_list_ptr)->value = typeId;
         expression_list_ptr = &(*expression_list_ptr)->next;
         while (LA() == T_COMMA) {
             consumeToken();
 
             if (parseTypeId(typeId)) {
                 *expression_list_ptr = new (_pool) ExpressionListAST;
-                (*expression_list_ptr)->expression = typeId;
+                (*expression_list_ptr)->value = typeId;
                 expression_list_ptr = &(*expression_list_ptr)->next;
             }
         }
@@ -1885,15 +1879,14 @@ bool Parser::parseExpressionList(ExpressionListAST *&node)
     ExpressionAST *expression = 0;
     if (parseAssignmentExpression(expression)) {
         *expression_list_ptr = new (_pool) ExpressionListAST;
-        (*expression_list_ptr)->expression = expression;
+        (*expression_list_ptr)->value = expression;
         expression_list_ptr = &(*expression_list_ptr)->next;
         while (LA() == T_COMMA) {
-            unsigned comma_token = consumeToken();
+            consumeToken(); // consume T_COMMA
 
             if (parseExpression(expression)) {
                 *expression_list_ptr = new (_pool) ExpressionListAST;
-                (*expression_list_ptr)->comma_token = comma_token;
-                (*expression_list_ptr)->expression = expression;
+                (*expression_list_ptr)->value = expression;
                 expression_list_ptr = &(*expression_list_ptr)->next;
             }
         }
@@ -1936,15 +1929,14 @@ bool Parser::parseInitializerList(ExpressionListAST *&node)
     ExpressionAST *initializer = 0;
     if (parseInitializerClause(initializer)) {
         *initializer_ptr = new (_pool) ExpressionListAST;
-        (*initializer_ptr)->expression = initializer;
+        (*initializer_ptr)->value = initializer;
         initializer_ptr = &(*initializer_ptr)->next;
         while (LA() == T_COMMA) {
-            unsigned comma_token = consumeToken();
+            consumeToken(); // consume T_COMMA
             initializer = 0;
             parseInitializerClause(initializer);
             *initializer_ptr = new (_pool) ExpressionListAST;
-            (*initializer_ptr)->comma_token = comma_token;
-            (*initializer_ptr)->expression = initializer;
+            (*initializer_ptr)->value = initializer;
             initializer_ptr = &(*initializer_ptr)->next;
         }
     }
@@ -2695,10 +2687,8 @@ bool Parser::parseAttributeList(AttributeAST *&node)
             ast->lparen_token = consumeToken();
             if (LA() == T_IDENTIFIER && (LA(2) == T_COMMA || LA(2) == T_RPAREN)) {
                 ast->tag_token = consumeToken();
-                if (LA() == T_COMMA) {
-                    ast->comma_token = consumeToken();
+                if (LA() == T_COMMA)
                     parseExpressionList(ast->expression_list);
-                }
             } else {
                 parseExpressionList(ast->expression_list);
             }
@@ -2865,11 +2855,11 @@ bool Parser::parseSimpleDeclaration(DeclarationAST *&node,
 
     if (LA() == T_COMMA || LA() == T_SEMICOLON || has_complex_type_specifier) {
         while (LA() == T_COMMA) {
-            unsigned comma_token = consumeToken();
+            consumeToken(); // consume T_COMMA
+
             declarator = 0;
             if (parseInitDeclarator(declarator, acceptStructDeclarator)) {
                 *declarator_ptr = new (_pool) DeclaratorListAST;
-                (*declarator_ptr)->comma_token = comma_token;
                 (*declarator_ptr)->declarator = declarator;
                 declarator_ptr = &(*declarator_ptr)->next;
             }
@@ -4314,11 +4304,10 @@ bool Parser::parseObjCClassForwardDeclaration(DeclarationAST *&node)
     IdentifierListAST **nextId = &(ast->identifier_list->next);
 
     while (LA() == T_COMMA) {
-        unsigned comma_token = consumeToken();
+        consumeToken(); // consume T_COMMA
         match(T_IDENTIFIER, &identifier_token);
 
         *nextId = new (_pool) IdentifierListAST;
-        (*nextId)->comma_token = comma_token;
         name = new (_pool) SimpleNameAST;
         name->identifier_token = identifier_token;
         (*nextId)->name = name;
@@ -4465,11 +4454,10 @@ bool Parser::parseObjCProtocol(DeclarationAST *&node,
         IdentifierListAST **nextId = &(ast->identifier_list->next);
 
         while (LA() == T_COMMA) {
-            unsigned comma_token = consumeToken();
+            consumeToken(); // consume T_COMMA
             match(T_IDENTIFIER, &identifier_token);
 
             *nextId = new (_pool) IdentifierListAST;
-            (*nextId)->comma_token = comma_token;
             name = new (_pool) SimpleNameAST;
             name->identifier_token = identifier_token;
             (*nextId)->name = name;
@@ -4599,7 +4587,8 @@ bool Parser::parseObjCMethodDefinitionList(DeclarationListAST *&node)
             }
 
             while (LA() == T_COMMA) {
-                last->comma_token = consumeToken();
+                consumeToken(); // consume T_COMMA
+
                 last->next = new (_pool) ObjCSynthesizedPropertyListAST;
                 last = last->next;
 
@@ -4629,11 +4618,12 @@ bool Parser::parseObjCMethodDefinitionList(DeclarationListAST *&node)
 
             IdentifierListAST *last = ast->property_identifiers;
             while (LA() == T_COMMA) {
-                last->comma_token = consumeToken();
+                consumeToken(); // consume T_COMMA
+
                 last->next = new (_pool) IdentifierListAST;
                 last = last->next;
                 name = new (_pool) SimpleNameAST;
-                match(T_IDENTIFIER, &(name->identifier_token));
+                match(T_IDENTIFIER, &name->identifier_token);
                 last->name = name;
             }
 
@@ -4713,11 +4703,10 @@ bool Parser::parseObjCProtocolRefs(ObjCProtocolRefsAST *&node)
     IdentifierListAST **nextId = &(ast->identifier_list->next);
 
     while (LA() == T_COMMA) {
-        unsigned comma_token = consumeToken();
+        consumeToken(); // consume T_COMMA
         match(T_IDENTIFIER, &identifier_token);
 
         *nextId = new (_pool) IdentifierListAST;
-        (*nextId)->comma_token = comma_token;
         name = new (_pool) SimpleNameAST;
         name->identifier_token = identifier_token;
         (*nextId)->name = name;
@@ -4860,7 +4849,7 @@ bool Parser::parseObjCPropertyDeclaration(DeclarationAST *&node, SpecifierAST *a
             ObjCPropertyAttributeListAST *last = ast->property_attributes;
 
             while (LA() == T_COMMA) {
-                last->comma_token = consumeToken();
+                consumeToken(); // consume T_COMMA
                 last->next = new (_pool) ObjCPropertyAttributeListAST;
                 last = last->next;
                 if (!parseObjCPropertyAttribute(last->attr)) {
-- 
GitLab