diff options
author | Erik Verbruggen <erik.verbruggen@nokia.com> | 2009-11-11 09:21:06 +0100 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@nokia.com> | 2009-11-11 09:21:06 +0100 |
commit | 72d4493fc21535f1f2720106e28ae3a6980851f5 (patch) | |
tree | 5bbd70967e7fd1e692c3cbfed9f389269025b9e3 /src/shared/cplusplus/CheckDeclarator.cpp | |
parent | 7938f9def974898bb8d05e98c4b59d983a887d79 (diff) | |
download | qt-creator-72d4493fc21535f1f2720106e28ae3a6980851f5.tar.gz |
Added scope calculation for Objective-C classes.
Diffstat (limited to 'src/shared/cplusplus/CheckDeclarator.cpp')
-rw-r--r-- | src/shared/cplusplus/CheckDeclarator.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/shared/cplusplus/CheckDeclarator.cpp b/src/shared/cplusplus/CheckDeclarator.cpp index 844cd9a5c7..9f28381105 100644 --- a/src/shared/cplusplus/CheckDeclarator.cpp +++ b/src/shared/cplusplus/CheckDeclarator.cpp @@ -246,21 +246,32 @@ bool CheckDeclarator::visit(ReferenceAST *) bool CheckDeclarator::visit(ObjCMethodPrototypeAST *ast) { + if (!ast) + return false; + + if (!ast->selector) { + // TODO: (EV) this currently happens when parsing: + // + (id<NSSomeProtocol>) zoo; + // where the parser will start doing template magic. We'll need to disambiguate this case. + return false; + } + FullySpecifiedType returnType = semantic()->check(ast->type_name, _scope); unsigned location = ast->firstToken(); - Name *name = semantic()->check(ast->selector, _scope); + semantic()->check(ast->selector, _scope); - ObjCMethod *method = control()->newObjCMethod(location, name); + ObjCMethod *method = control()->newObjCMethod(location, ast->selector->selector_name); ast->symbol = method; method->setSourceLocation(location); method->setScope(_scope); method->setVisibility(semantic()->currentVisibility()); method->setReturnType(returnType); + if (semantic()->isObjCClassMethod(tokenKind(ast->method_type_token))) + method->setStorage(Symbol::Static); if (ast->selector && ast->selector->asObjCSelectorWithArguments()) { - // TODO: add arguments (EV) for (ObjCMessageArgumentDeclarationListAST *it = ast->argument_list; it; it = it->next) { ObjCMessageArgumentDeclarationAST *argDecl = it->value; @@ -273,8 +284,6 @@ bool CheckDeclarator::visit(ObjCMethodPrototypeAST *ast) _fullySpecifiedType = FullySpecifiedType(method); - // TODO: check which specifiers are allowed here (EV) - return false; } |