Added ObjC method prototypes to the AST.

This commit is contained in:
Erik Verbruggen
2009-07-16 17:38:24 +02:00
parent 01ee7a95c9
commit a3d129527f
8 changed files with 233 additions and 28 deletions

View File

@@ -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