diff options
author | Roberto Raggi <roberto.raggi@nokia.com> | 2010-06-03 16:38:25 +0200 |
---|---|---|
committer | Roberto Raggi <roberto.raggi@nokia.com> | 2010-06-03 16:38:59 +0200 |
commit | 53e775cbde0b5c47e2db6a71c2dc3b9b177ce571 (patch) | |
tree | 453ef27563dc6d540953cb4b581ce8b984341123 /src/shared/cplusplus/AST.cpp | |
parent | 21073563a4712f6dd663184ed91c05131ffa3de2 (diff) | |
download | qt-creator-53e775cbde0b5c47e2db6a71c2dc3b9b177ce571.tar.gz |
Return valid tokens for the Objc nodes.
Diffstat (limited to 'src/shared/cplusplus/AST.cpp')
-rw-r--r-- | src/shared/cplusplus/AST.cpp | 76 |
1 files changed, 55 insertions, 21 deletions
diff --git a/src/shared/cplusplus/AST.cpp b/src/shared/cplusplus/AST.cpp index 359467b27d..85c87ec7ee 100644 --- a/src/shared/cplusplus/AST.cpp +++ b/src/shared/cplusplus/AST.cpp @@ -2053,26 +2053,52 @@ unsigned ObjCClassDeclarationAST::firstToken() const unsigned ObjCClassDeclarationAST::lastToken() const { - if (end_token) return end_token + 1; - if (member_declaration_list) return member_declaration_list->lastToken(); - if (inst_vars_decl) return inst_vars_decl->lastToken(); - if (protocol_refs) - return protocol_refs->lastToken(); - if (superclass) - return superclass->lastToken(); - if (colon_token) return colon_token + 1; + if (end_token) + return end_token + 1; + + if (member_declaration_list) { + if (unsigned token = member_declaration_list->lastToken()) + return token; + } + + if (inst_vars_decl) { + if (unsigned token = inst_vars_decl->lastToken()) + return token; + } + + if (protocol_refs) { + if (unsigned token = protocol_refs->lastToken()) + return token; + } + + if (superclass) { + if (unsigned token = superclass->lastToken()) + return token; + } + + if (colon_token) + return colon_token + 1; + if (rparen_token) return rparen_token + 1; - if (category_name) - return category_name->lastToken(); + + if (category_name) { + if (unsigned token = category_name->lastToken()) + return token; + } + if (lparen_token) return lparen_token + 1; - if (class_name) return class_name->lastToken(); + + if (class_name) { + if (unsigned token = class_name->lastToken()) + return token; + } if (interface_token) return interface_token + 1; - else - return implementation_token + 1; + + return implementation_token + 1; } unsigned ObjCProtocolDeclarationAST::firstToken() const @@ -2087,17 +2113,25 @@ unsigned ObjCProtocolDeclarationAST::lastToken() const if (end_token) return end_token + 1; - else if (member_declaration_list) - return member_declaration_list->lastToken(); + if (member_declaration_list) { + if (unsigned token = member_declaration_list->lastToken()) + return token; + } - else if (protocol_refs) - return protocol_refs->lastToken(); + if (protocol_refs) { + if (unsigned token = protocol_refs->lastToken()) + return token; + } - else if (name) - return name->lastToken(); + if (name) { + if (unsigned token = name->lastToken()) + return token; + } - else if (attribute_list) - return attribute_list->lastToken(); + if (attribute_list) { + if (unsigned token = attribute_list->lastToken()) + return token; + } return protocol_token + 1; } |