From 5e40f21183178a5ae4023b91d6266bb0bea0ac97 Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Mon, 5 Jan 2009 10:26:20 +0100 Subject: [PATCH] Implemented IfStatementAST::lastToken(). --- shared/cplusplus/AST.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/shared/cplusplus/AST.cpp b/shared/cplusplus/AST.cpp index 67ff46ca4fe..33de30e968f 100644 --- a/shared/cplusplus/AST.cpp +++ b/shared/cplusplus/AST.cpp @@ -1554,14 +1554,19 @@ unsigned IfStatementAST::firstToken() const unsigned IfStatementAST::lastToken() const { - assert(0 && "review me"); if (else_statement) return else_statement->lastToken(); else if (else_token) return else_token + 1; else if (statement) return statement->lastToken(); - return rparen_token + 1; + else if (rparen_token) + return rparen_token + 1; + else if (condition) + return condition->lastToken(); + else if (lparen_token) + return lparen_token + 1; + return if_token + 1; } void LabeledStatementAST::accept0(ASTVisitor *visitor)