summaryrefslogtreecommitdiff
path: root/src/shared/cplusplus/AST.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com>2009-05-11 16:34:35 +0200
committerThorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com>2009-05-11 17:03:51 +0200
commitecc2b25ddcdf3567907643df8d1b7a3512a58392 (patch)
tree5bc9bbf78858425d472dffa893995c59deed98ef /src/shared/cplusplus/AST.cpp
parent36a94b69b12e458a99b12067e8220f541fcdeb39 (diff)
downloadqt-creator-ecc2b25ddcdf3567907643df8d1b7a3512a58392.tar.gz
Extended the AST with references to more tokens
Mainly comma tokens. Referencing all tokens is necessary to be able to implement pretty-printing based on the AST while maintaining user formatting. Reviewed-by: Roberto Raggi
Diffstat (limited to 'src/shared/cplusplus/AST.cpp')
-rw-r--r--src/shared/cplusplus/AST.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/shared/cplusplus/AST.cpp b/src/shared/cplusplus/AST.cpp
index 1f051146bf..53098b4a5e 100644
--- a/src/shared/cplusplus/AST.cpp
+++ b/src/shared/cplusplus/AST.cpp
@@ -148,6 +148,7 @@ AttributeAST *AttributeAST::clone(MemoryPool *pool) const
ast->rparen_token = rparen_token;
if (next)
ast->next = next->clone(pool);
+ ast->comma_token = comma_token;
return ast;
}
@@ -331,6 +332,7 @@ unsigned AsmDefinitionAST::lastToken() const
BaseSpecifierAST *BaseSpecifierAST::clone(MemoryPool *pool) const
{
BaseSpecifierAST *ast = new (pool) BaseSpecifierAST;
+ ast->comma_token = comma_token;
ast->token_virtual = token_virtual;
ast->token_access_specifier = token_access_specifier;
if (name)
@@ -1149,6 +1151,7 @@ unsigned DeclaratorIdAST::lastToken() const
DeclaratorListAST *DeclaratorListAST::clone(MemoryPool *pool) const
{
DeclaratorListAST *ast = new (pool) DeclaratorListAST;
+ ast->comma_token = comma_token;
if (declarator)
ast->declarator = declarator->clone(pool);
if (next)
@@ -1395,6 +1398,7 @@ unsigned EnumSpecifierAST::lastToken() const
EnumeratorAST *EnumeratorAST::clone(MemoryPool *pool) const
{
EnumeratorAST *ast = new (pool) EnumeratorAST;
+ ast->comma_token = comma_token;
ast->identifier_token = identifier_token;
ast->equal_token = equal_token;
if (expression)
@@ -1517,6 +1521,7 @@ unsigned ExceptionSpecificationAST::lastToken() const
ExpressionListAST *ExpressionListAST::clone(MemoryPool *pool) const
{
ExpressionListAST *ast = new (pool) ExpressionListAST;
+ ast->comma_token = comma_token;
if (expression)
ast->expression = expression->clone(pool);
if (next)
@@ -1954,6 +1959,7 @@ unsigned LinkageSpecificationAST::lastToken() const
MemInitializerAST *MemInitializerAST::clone(MemoryPool *pool) const
{
MemInitializerAST *ast = new (pool) MemInitializerAST;
+ ast->comma_token = comma_token;
if (name)
ast->name = name->clone(pool);
ast->lparen_token = lparen_token;
@@ -2938,8 +2944,10 @@ TypeofSpecifierAST *TypeofSpecifierAST::clone(MemoryPool *pool) const
{
TypeofSpecifierAST *ast = new (pool) TypeofSpecifierAST;
ast->typeof_token = typeof_token;
+ ast->lparen_token = lparen_token;
if (expression)
ast->expression = expression->clone(pool);
+ ast->rparen_token = rparen_token;
if (next)
ast->next = next->clone(pool);
return ast;
@@ -3066,6 +3074,7 @@ unsigned SwitchStatementAST::lastToken() const
TemplateArgumentListAST *TemplateArgumentListAST::clone(MemoryPool *pool) const
{
TemplateArgumentListAST *ast = new (pool) TemplateArgumentListAST;
+ ast->comma_token = comma_token;
if (template_argument)
ast->template_argument = template_argument->clone(pool);
if (next)