From 5a06e283e8777069b64891c0dfc05c97960866a6 Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Tue, 6 Jan 2009 11:45:04 +0100 Subject: [PATCH] QualifiedNameAST::lastToken(). --- shared/cplusplus/AST.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/shared/cplusplus/AST.cpp b/shared/cplusplus/AST.cpp index 13098ffa9d7..b6ddde0c0eb 100644 --- a/shared/cplusplus/AST.cpp +++ b/shared/cplusplus/AST.cpp @@ -2112,7 +2112,6 @@ unsigned PostIncrDecrAST::firstToken() const unsigned PostIncrDecrAST::lastToken() const { - assert(0 && "review me"); return incr_decr_token + 1; } @@ -2132,7 +2131,6 @@ unsigned PostfixExpressionAST::firstToken() const unsigned PostfixExpressionAST::lastToken() const { - assert(0 && "review me"); for (PostfixAST *it = postfix_expressions; it; it = it->next) { if (! it->next) return it->lastToken(); @@ -2159,12 +2157,18 @@ unsigned QualifiedNameAST::firstToken() const unsigned QualifiedNameAST::lastToken() const { - assert(0 && "review me"); if (unqualified_name) return unqualified_name->lastToken(); - else if (nested_name_specifier) - return nested_name_specifier->lastToken(); - return global_scope_token + 1; + + for (NestedNameSpecifierAST *it = nested_name_specifier; it; it = it->next) { + if (! it->next) + return it->lastToken(); + } + + if (global_scope_token) + return global_scope_token + 1; + + return 0; } void ReferenceAST::accept0(ASTVisitor *visitor)