From a3d129527fbce3a4b52b68eddaf65de0b54cca0c Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Thu, 16 Jul 2009 17:38:24 +0200 Subject: Added ObjC method prototypes to the AST. --- src/shared/cplusplus/AST.cpp | 58 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) (limited to 'src/shared/cplusplus/AST.cpp') 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 -- cgit v1.2.1