diff options
author | Roberto Raggi <qtc-committer@nokia.com> | 2009-02-09 17:44:06 +0100 |
---|---|---|
committer | Roberto Raggi <qtc-committer@nokia.com> | 2009-02-09 17:49:12 +0100 |
commit | d01795d9334a96f0ae3f2b19b689fe9abd7fdf34 (patch) | |
tree | 79e782f3e7a3797750e9e37cf26106f322426e8a /src/shared/cplusplus/CheckDeclaration.cpp | |
parent | ce22a96041ed7a61b09ea9596f415d30d67e68f1 (diff) | |
download | qt-creator-d01795d9334a96f0ae3f2b19b689fe9abd7fdf34.tar.gz |
Reimplemented Type::as*Type() using virtual methods.
Diffstat (limited to 'src/shared/cplusplus/CheckDeclaration.cpp')
-rw-r--r-- | src/shared/cplusplus/CheckDeclaration.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/shared/cplusplus/CheckDeclaration.cpp b/src/shared/cplusplus/CheckDeclaration.cpp index 179dd06987..ee9e80ffa6 100644 --- a/src/shared/cplusplus/CheckDeclaration.cpp +++ b/src/shared/cplusplus/CheckDeclaration.cpp @@ -130,8 +130,8 @@ bool CheckDeclaration::visit(SimpleDeclarationAST *ast) FullySpecifiedType ty = semantic()->check(ast->decl_specifier_seq, _scope); FullySpecifiedType qualTy = ty.qualifiedType(); - if (_templateParameters) { - if (Class *klass = ty->asClass()) { + if (_templateParameters && ty) { + if (Class *klass = ty->asClassType()) { klass->setTemplateParameters(_templateParameters); } } @@ -142,7 +142,8 @@ bool CheckDeclaration::visit(SimpleDeclarationAST *ast) FullySpecifiedType declTy = semantic()->check(it->declarator, qualTy, _scope, &name); - if (Function *fun = declTy->asFunction()) { + Function *fun = 0; + if (declTy && 0 != (fun = declTy->asFunctionType())) { fun->setScope(_scope); fun->setName(name); fun->setMethodKey(semantic()->currentMethodKey()); @@ -162,7 +163,7 @@ bool CheckDeclaration::visit(SimpleDeclarationAST *ast) symbol->setType(control()->integerType(IntegerType::Int)); symbol->setType(declTy); - if (_templateParameters && it == ast->declarators && ! ty->asClass()) + if (_templateParameters && it == ast->declarators && ty && ! ty->isClassType()) symbol->setTemplateParameters(_templateParameters); symbol->setVisibility(semantic()->currentVisibility()); @@ -225,13 +226,13 @@ bool CheckDeclaration::visit(FunctionDefinitionAST *ast) Name *name = 0; FullySpecifiedType funTy = semantic()->check(ast->declarator, qualTy, _scope, &name); - Function *fun = funTy->asFunction(); - if (! fun) { + if (! (funTy && funTy->isFunctionType())) { translationUnit()->error(ast->firstToken(), "expected a function prototype"); return false; } + Function *fun = funTy->asFunctionType(); fun->setName(name); fun->setTemplateParameters(_templateParameters); fun->setVisibility(semantic()->currentVisibility()); |