summaryrefslogtreecommitdiff
path: root/src/shared/cplusplus/AST.cpp
diff options
context:
space:
mode:
authorcon <qtc-committer@nokia.com>2009-06-16 14:58:28 +0200
committercon <qtc-committer@nokia.com>2009-06-16 14:58:28 +0200
commit4f4f767b2b4e7a27096e5d260d3991811bd17b47 (patch)
tree43ee2a5c129753ebd5574c8c1a1f86aca83066ec /src/shared/cplusplus/AST.cpp
parent7594cc5a41f272f47b62f2a5c944fb06f630c309 (diff)
parentaa2836f1dc9e5942ad65ac445d09a87372430ecf (diff)
downloadqt-creator-4f4f767b2b4e7a27096e5d260d3991811bd17b47.tar.gz
Merge commit 'origin/1.2'
Diffstat (limited to 'src/shared/cplusplus/AST.cpp')
-rw-r--r--src/shared/cplusplus/AST.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/shared/cplusplus/AST.cpp b/src/shared/cplusplus/AST.cpp
index 77461d53d9..97121d3c7e 100644
--- a/src/shared/cplusplus/AST.cpp
+++ b/src/shared/cplusplus/AST.cpp
@@ -843,15 +843,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;
}
@@ -2033,10 +2041,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)