From 2fb5e63097dfb8b37896e71e0718d63844f64fc3 Mon Sep 17 00:00:00 2001 From: Roberto Raggi <qtc-committer@nokia.com> Date: Tue, 6 Jan 2009 12:01:57 +0100 Subject: [PATCH] TypeConstructorCallAST::lastToken(). --- shared/cplusplus/AST.cpp | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/shared/cplusplus/AST.cpp b/shared/cplusplus/AST.cpp index 4ab7cdc4248..8cb625b4ad9 100644 --- a/shared/cplusplus/AST.cpp +++ b/shared/cplusplus/AST.cpp @@ -2499,7 +2499,6 @@ unsigned ThisExpressionAST::firstToken() const unsigned ThisExpressionAST::lastToken() const { - assert(0 && "review me"); return this_token + 1; } @@ -2517,7 +2516,6 @@ unsigned ThrowExpressionAST::firstToken() const unsigned ThrowExpressionAST::lastToken() const { - assert(0 && "review me"); if (expression) return expression->lastToken(); return throw_token + 1; @@ -2539,7 +2537,6 @@ unsigned TranslationUnitAST::firstToken() const unsigned TranslationUnitAST::lastToken() const { - assert(0 && "review me"); for (DeclarationAST *it = declarations; it; it = it->next) { if (! it->next) return it->lastToken(); @@ -2562,13 +2559,14 @@ unsigned TryBlockStatementAST::firstToken() const unsigned TryBlockStatementAST::lastToken() const { - assert(0 && "review me"); for (CatchClauseAST *it = catch_clause_seq; it; it = it->next) { if (! it->next) return it->lastToken(); } + if (statement) return statement->lastToken(); + return try_token + 1; } @@ -2590,8 +2588,24 @@ unsigned TypeConstructorCallAST::firstToken() const unsigned TypeConstructorCallAST::lastToken() const { - assert(0 && "review me"); - return rparen_token + 1; + if (rparen_token) + return rparen_token + 1; + + for (ExpressionListAST *it = expression_list; it; it = it->next) { + if (! it->next) + return it->lastToken(); + } + + if (lparen_token) + return lparen_token + 1; + + + for (SpecifierAST *it = type_specifier; it; it = it->next) { + if (! it->next) + return it->lastToken(); + } + + return 0; } void TypeIdAST::accept0(ASTVisitor *visitor) -- GitLab