summaryrefslogtreecommitdiff
path: root/src/shared/cplusplus/AST.cpp
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@nokia.com>2009-07-16 17:38:24 +0200
committerErik Verbruggen <erik.verbruggen@nokia.com>2009-07-16 17:38:24 +0200
commita3d129527fbce3a4b52b68eddaf65de0b54cca0c (patch)
tree228a3831573edbb65e8ca0f68cd764fd011ebf65 /src/shared/cplusplus/AST.cpp
parent01ee7a95c9e19cbeee083363ba57e90c1ac4b20d (diff)
downloadqt-creator-a3d129527fbce3a4b52b68eddaf65de0b54cca0c.tar.gz
Added ObjC method prototypes to the AST.
Diffstat (limited to 'src/shared/cplusplus/AST.cpp')
-rw-r--r--src/shared/cplusplus/AST.cpp58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/shared/cplusplus/AST.cpp b/src/shared/cplusplus/AST.cpp
index 08fcb2fa9d..51a3c1ac34 100644
--- a/src/shared/cplusplus/AST.cpp
+++ b/src/shared/cplusplus/AST.cpp
@@ -2258,4 +2258,62 @@ unsigned ObjCPropertyDeclarationAST::lastToken() const
return property_token + 1;
}
+unsigned ObjCMessageArgumentDeclarationAST::firstToken() const
+{
+ return param_selector_token;
+}
+
+unsigned ObjCMessageArgumentDeclarationAST::lastToken() const
+{
+ if (param_name_token)
+ return param_name_token + 1;
+ else if (colon_token)
+ return colon_token + 1;
+ else if (type_name)
+ return type_name->lastToken();
+ else if (attributes)
+ return attributes->lastToken();
+ else
+ return param_name_token + 1;
+}
+
+unsigned ObjCMessageArgumentDeclarationListAST::firstToken() const
+{
+ if (argument_declaration)
+ return argument_declaration->firstToken();
+ else if (next)
+ return next->firstToken();
+ else
+ // ### Assert?
+ return 0;
+}
+
+unsigned ObjCMessageArgumentDeclarationListAST::lastToken() const
+{
+ for (const ObjCMessageArgumentDeclarationListAST *it = this; it; it = it->next) {
+ if (! it->next && it->argument_declaration) {
+ return it->argument_declaration->lastToken();
+ }
+ }
+ // ### assert?
+ return 0;
+}
+
+unsigned ObjCMethodPrototypeAST::firstToken() const
+{
+ return method_type_token;
+}
+
+unsigned ObjCMethodPrototypeAST::lastToken() const
+{
+ if (attributes)
+ return attributes->lastToken();
+ else if (arguments)
+ return arguments->lastToken();
+ else if (type_name)
+ return type_name->lastToken();
+ else
+ return method_type_token + 1;
+}
+
CPLUSPLUS_END_NAMESPACE