diff options
author | Kavindra Devi Palaraja <kavindra.palaraja@nokia.com> | 2009-06-16 10:59:45 +0200 |
---|---|---|
committer | Kavindra Devi Palaraja <kavindra.palaraja@nokia.com> | 2009-06-16 10:59:45 +0200 |
commit | a884e354f184dabdcead6a600fa4f8cb41a7d8de (patch) | |
tree | a092f3ecb9f215783ec57b465feb8e5a02638cdb | |
parent | 395037918f6518b526f7aa09b627fbca140e6c82 (diff) | |
parent | 4164d31712ce330b506f3d1f8985e7d73d24afe4 (diff) |
Merge branch '1.2' of git@scm.dev.nokia.troll.no:creator/mainline into 1.2
-rw-r--r-- | src/shared/cplusplus/AST.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/shared/cplusplus/AST.cpp b/src/shared/cplusplus/AST.cpp index 53098b4a5ee..70d8b9223e3 100644 --- a/src/shared/cplusplus/AST.cpp +++ b/src/shared/cplusplus/AST.cpp @@ -1170,15 +1170,23 @@ void DeclaratorListAST::accept0(ASTVisitor *visitor) unsigned DeclaratorListAST::firstToken() const { + if (comma_token) + return comma_token; + return declarator->firstToken(); } unsigned DeclaratorListAST::lastToken() const { for (const DeclaratorListAST *it = this; it; it = it->next) { - if (! it->next) - return it->declarator->lastToken(); + if (! it->next) { + if (it->declarator) + return it->declarator->lastToken(); + else if (it->comma_token) + return it->comma_token + 1; + } } + return 0; } @@ -2877,10 +2885,8 @@ unsigned SimpleDeclarationAST::lastToken() const if (semicolon_token) return semicolon_token + 1; - for (DeclaratorListAST *it = declarators; it; it = it->next) { - if (! it->next) - return it->lastToken(); - } + if (declarators) + return declarators->lastToken(); for (SpecifierAST *it = decl_specifier_seq; it; it = it->next) { if (! it->next) |