summaryrefslogtreecommitdiff
path: root/src/shared/cplusplus/AST.cpp
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@nokia.com>2009-08-05 17:14:08 +0200
committerErik Verbruggen <erik.verbruggen@nokia.com>2009-08-05 17:14:08 +0200
commitca34b0ca1c57a0ec0f8f61ad1b0dd4f8bfc9b554 (patch)
treef6a3f16210a3d6a2ccfed259be90af8c218ce623 /src/shared/cplusplus/AST.cpp
parentafd9fd824d6d61e5d6698b09bd2fe304977ccad4 (diff)
downloadqt-creator-ca34b0ca1c57a0ec0f8f61ad1b0dd4f8bfc9b554.tar.gz
Cleaned the ObjC AST up.
Diffstat (limited to 'src/shared/cplusplus/AST.cpp')
-rw-r--r--src/shared/cplusplus/AST.cpp128
1 files changed, 26 insertions, 102 deletions
diff --git a/src/shared/cplusplus/AST.cpp b/src/shared/cplusplus/AST.cpp
index 266d49c999..3f417543dc 100644
--- a/src/shared/cplusplus/AST.cpp
+++ b/src/shared/cplusplus/AST.cpp
@@ -1924,14 +1924,14 @@ unsigned IdentifierListAST::lastToken() const
}
-unsigned ObjCClassDeclarationAST::firstToken() const
+unsigned ObjCClassForwardDeclarationAST::firstToken() const
{
if (attributes)
return attributes->firstToken();
return class_token;
}
-unsigned ObjCClassDeclarationAST::lastToken() const
+unsigned ObjCClassForwardDeclarationAST::lastToken() const
{
if (semicolon_token)
return semicolon_token + 1;
@@ -1941,22 +1941,17 @@ unsigned ObjCClassDeclarationAST::lastToken() const
return it->name->lastToken();
}
- for (SpecifierAST *it = attributes; it; it = it->next) {
- if (! it->next)
- return it->lastToken();
- }
-
return class_token + 1;
}
-unsigned ObjCProtocolDeclarationAST::firstToken() const
+unsigned ObjCProtocolForwardDeclarationAST::firstToken() const
{
if (attributes)
return attributes->firstToken();
return protocol_token;
}
-unsigned ObjCProtocolDeclarationAST::lastToken() const
+unsigned ObjCProtocolForwardDeclarationAST::lastToken() const
{
if (semicolon_token)
return semicolon_token + 1;
@@ -1966,69 +1961,52 @@ unsigned ObjCProtocolDeclarationAST::lastToken() const
return it->name->lastToken();
}
- for (SpecifierAST *it = attributes; it; it = it->next) {
- if (! it->next)
- return it->lastToken();
- }
-
return protocol_token + 1;
}
-unsigned ObjCClassInterfaceDefinitionAST::firstToken() const
+unsigned ObjCClassDeclarationAST::firstToken() const
{
if (attributes)
return attributes->firstToken();
- return interface_token;
+
+ if (interface_token)
+ return interface_token;
+ else
+ return implementation_token;
}
-unsigned ObjCClassInterfaceDefinitionAST::lastToken() const
+unsigned ObjCClassDeclarationAST::lastToken() const
{
if (end_token) return end_token + 1;
if (member_declarations) return member_declarations->lastToken();
if (inst_vars_decl) return inst_vars_decl->lastToken();
- if (superclass_identifier_token) return superclass_identifier_token + 1;
+ if (protocol_refs)
+ return protocol_refs->lastToken();
+ if (superclass)
+ return superclass->lastToken();
if (colon_token) return colon_token + 1;
+ if (rparen_token)
+ return rparen_token + 1;
+ if (category_name)
+ return category_name->lastToken();
+ if (lparen_token)
+ return lparen_token + 1;
if (class_name) return class_name->lastToken();
- for (SpecifierAST *it = attributes; it; it = it->next) {
- if (! it->next)
- return it->lastToken();
- }
-
- return interface_token + 1;
-}
-
-unsigned ObjCCategoryInterfaceDeclarationAST::firstToken() const
-{
- if (attributes)
- return attributes->firstToken();
+ if (interface_token)
+ return interface_token + 1;
else
- return interface_token;
+ return implementation_token + 1;
}
-unsigned ObjCCategoryInterfaceDeclarationAST::lastToken() const
-{
- if (end_token)
- return end_token + 1;
-
- if (member_declarations)
- return member_declarations->lastToken();
-
- if (rparen_token) return rparen_token + 1;
- if (category_identifier_token) return category_identifier_token + 1;
- if (lparen_token) return lparen_token + 1;
- if (class_identifier_token) return class_identifier_token + 1;
- return interface_token + 1;
-}
-
-unsigned ObjCProtocolDefinitionAST::firstToken() const
+unsigned ObjCProtocolDeclarationAST::firstToken() const
{
if (attributes)
return attributes->firstToken();
return protocol_token;
}
-unsigned ObjCProtocolDefinitionAST::lastToken() const
+unsigned ObjCProtocolDeclarationAST::lastToken() const
{
if (end_token)
return end_token + 1;
@@ -2403,60 +2381,6 @@ unsigned ObjCMethodDeclarationAST::lastToken() const
return method_prototype->lastToken();
}
-unsigned ObjCClassImplementationAST::firstToken() const
-{
- return implementation_token;
-}
-
-unsigned ObjCClassImplementationAST::lastToken() const
-{
- if (end_token)
- return end_token + 1;
-
- for (DeclarationListAST *it = declarations; it; it = it->next) {
- if (! it->next)
- return it->lastToken();
- }
-
- if (inst_vars_decl)
- return inst_vars_decl->lastToken();
- if (super_class_identifier)
- return super_class_identifier + 1;
- if (colon_token)
- return colon_token + 1;
- if (class_identifier)
- return class_identifier + 1;
-
- return implementation_token + 1;
-}
-
-unsigned ObjCCategoryImplementationAST::firstToken() const
-{
- return implementation_token;
-}
-
-unsigned ObjCCategoryImplementationAST::lastToken() const
-{
- if (end_token)
- return end_token + 1;
-
- for (DeclarationListAST *it = declarations; it; it = it->next) {
- if (! it->next)
- return it->lastToken();
- }
-
- if (rparen_token)
- return rparen_token + 1;
- if (category_name_token)
- return category_name_token + 1;
- if (lparen_token)
- return lparen_token + 1;
- if (class_identifier)
- return class_identifier + 1;
-
- return implementation_token + 1;
-}
-
unsigned ObjCSynthesizedPropertyAST::firstToken() const
{
if (property_identifier)