summaryrefslogtreecommitdiff
path: root/src/shared/cplusplus/CheckStatement.cpp
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@nokia.com>2009-08-05 18:30:18 +0200
committerErik Verbruggen <erik.verbruggen@nokia.com>2009-08-05 18:30:18 +0200
commit86a7b26fcd09c5c0510410631421956b877db840 (patch)
tree8b116f47776c64b60d182c246f9ddeab534403a7 /src/shared/cplusplus/CheckStatement.cpp
parentca34b0ca1c57a0ec0f8f61ad1b0dd4f8bfc9b554 (diff)
downloadqt-creator-86a7b26fcd09c5c0510410631421956b877db840.tar.gz
Fixed semantic checks for Objective-C methods and fast-enumeration.
Diffstat (limited to 'src/shared/cplusplus/CheckStatement.cpp')
-rw-r--r--src/shared/cplusplus/CheckStatement.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/shared/cplusplus/CheckStatement.cpp b/src/shared/cplusplus/CheckStatement.cpp
index c93eca0492..ae91f5191e 100644
--- a/src/shared/cplusplus/CheckStatement.cpp
+++ b/src/shared/cplusplus/CheckStatement.cpp
@@ -170,6 +170,34 @@ bool CheckStatement::visit(ForeachStatementAST *ast)
return false;
}
+bool CheckStatement::visit(ObjCFastEnumerationAST *ast)
+{
+ Block *block = control()->newBlock(ast->for_token);
+ block->setStartOffset(tokenAt(ast->firstToken()).offset);
+ block->setEndOffset(tokenAt(ast->lastToken()).offset);
+ ast->symbol = block;
+ _scope->enterSymbol(block);
+ Scope *previousScope = switchScope(block->members());
+ if (ast->type_specifiers && ast->declarator) {
+ FullySpecifiedType ty = semantic()->check(ast->type_specifiers, _scope);
+ Name *name = 0;
+ ty = semantic()->check(ast->declarator, ty, _scope, &name);
+ unsigned location = ast->declarator->firstToken();
+ if (CoreDeclaratorAST *core_declarator = ast->declarator->core_declarator)
+ location = core_declarator->firstToken();
+ Declaration *decl = control()->newDeclaration(location, name);
+ decl->setType(ty);
+ _scope->enterSymbol(decl);
+ } else {
+ FullySpecifiedType exprTy = semantic()->check(ast->initializer, _scope);
+ (void) exprTy;
+ }
+
+ semantic()->check(ast->body_statement, _scope);
+ (void) switchScope(previousScope);
+ return false;
+}
+
bool CheckStatement::visit(ForStatementAST *ast)
{
Block *block = control()->newBlock(ast->for_token);