summaryrefslogtreecommitdiff
path: root/src/shared/cplusplus/CheckDeclarator.cpp
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@nokia.com>2009-07-28 16:34:15 +0200
committerErik Verbruggen <erik.verbruggen@nokia.com>2009-07-28 16:34:15 +0200
commit26267c03445266233159b2f61bbc3a4d5864c01a (patch)
tree8b7536d8f41fea63adc180d56830a73aae1192ad /src/shared/cplusplus/CheckDeclarator.cpp
parenta9b521f80af025ac11f9735fc070606952894b60 (diff)
downloadqt-creator-26267c03445266233159b2f61bbc3a4d5864c01a.tar.gz
Improved ObjC parsing, and added semantic checks.
Diffstat (limited to 'src/shared/cplusplus/CheckDeclarator.cpp')
-rw-r--r--src/shared/cplusplus/CheckDeclarator.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/shared/cplusplus/CheckDeclarator.cpp b/src/shared/cplusplus/CheckDeclarator.cpp
index bf9ae94cb9..27a0a03fc3 100644
--- a/src/shared/cplusplus/CheckDeclarator.cpp
+++ b/src/shared/cplusplus/CheckDeclarator.cpp
@@ -94,6 +94,15 @@ FullySpecifiedType CheckDeclarator::check(PtrOperatorAST *ptrOperators,
return switchFullySpecifiedType(previousType);
}
+FullySpecifiedType CheckDeclarator::check(ObjCMethodPrototypeAST *methodPrototype,
+ Scope *scope)
+{
+ Scope *previousScope = switchScope(scope);
+ accept(methodPrototype);
+ (void) switchScope(previousScope);
+ return _fullySpecifiedType;
+}
+
DeclaratorAST *CheckDeclarator::switchDeclarator(DeclaratorAST *declarator)
{
DeclaratorAST *previousDeclarator = _declarator;
@@ -237,6 +246,34 @@ bool CheckDeclarator::visit(ReferenceAST *ast)
return false;
}
+bool CheckDeclarator::visit(ObjCMethodPrototypeAST *ast)
+{
+ unsigned location = ast->firstToken();
+
+ Name *name = semantic()->check(ast->selector, _scope);
+
+ Function *fun = control()->newFunction(location, name);
+ ast->symbol = fun;
+ fun->setSourceLocation(location);
+ fun->setScope(_scope);
+ fun->setMethodKey(Function::NormalMethod);
+ fun->setVisibility(semantic()->currentVisibility());
+ fun->setPureVirtual(false);
+
+ // TODO: check return type (EV)
+// fun->setReturnType(semantic()->check(ast->type_name, _scope));
+ // TODO: check the parameters (EV)
+ // fun->setVariadic(...);
+ // TODO: add arguments (EV)
+
+ FullySpecifiedType mTy(fun);
+ _fullySpecifiedType = mTy;
+
+ // TODO: check which specifiers are allowed here (EV)
+
+ return false;
+}
+
void CheckDeclarator::applyCvQualifiers(SpecifierAST *cv)
{
for (; cv; cv = cv->next) {