forked from qt-creator/qt-creator
Fixed return-type checking for ObjC methods.
This commit is contained in:
@@ -720,10 +720,6 @@ bool CheckDeclaration::visit(ObjCMethodDeclarationAST *ast)
|
||||
|
||||
Symbol *symbol;
|
||||
if (ast->function_body) {
|
||||
if (!semantic()->skipFunctionBodies()) {
|
||||
semantic()->check(ast->function_body, methodTy->members());
|
||||
}
|
||||
|
||||
symbol = methodTy;
|
||||
} else {
|
||||
Declaration *decl = control()->newDeclaration(selector->firstToken(), methodTy->name());
|
||||
@@ -742,6 +738,10 @@ bool CheckDeclaration::visit(ObjCMethodDeclarationAST *ast)
|
||||
|
||||
_scope->enterSymbol(symbol);
|
||||
|
||||
if (ast->function_body && !semantic()->skipFunctionBodies()) {
|
||||
semantic()->check(ast->function_body, methodTy->members());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -260,7 +260,9 @@ bool CheckDeclarator::visit(ObjCMethodPrototypeAST *ast)
|
||||
return false;
|
||||
}
|
||||
|
||||
FullySpecifiedType returnType = semantic()->check(ast->type_name, _scope);
|
||||
FullySpecifiedType returnType;
|
||||
if (ast->type_name && ast->type_name->type_id)
|
||||
returnType = semantic()->check(ast->type_name->type_id, _scope);
|
||||
|
||||
unsigned location = ast->selector->firstToken();
|
||||
|
||||
|
||||
@@ -394,8 +394,8 @@ bool CheckName::visit(ObjCMessageArgumentDeclarationAST *ast)
|
||||
{
|
||||
FullySpecifiedType type;
|
||||
|
||||
if (ast->type_name)
|
||||
type = semantic()->check(ast->type_name, _scope);
|
||||
if (ast->type_name && ast->type_name->type_id)
|
||||
type = semantic()->check(ast->type_name->type_id, _scope);
|
||||
|
||||
if (ast->param_name) {
|
||||
accept(ast->param_name);
|
||||
|
||||
@@ -82,19 +82,6 @@ FullySpecifiedType CheckSpecifier::check(SpecifierListAST *specifier,
|
||||
return switchFullySpecifiedType(previousType);
|
||||
}
|
||||
|
||||
FullySpecifiedType CheckSpecifier::check(ObjCTypeNameAST *typeName,
|
||||
Scope *scope,
|
||||
const FullySpecifiedType &ty)
|
||||
{
|
||||
FullySpecifiedType previousType = switchFullySpecifiedType(ty);
|
||||
Scope *previousScope = switchScope(scope);
|
||||
|
||||
accept(typeName);
|
||||
|
||||
(void) switchScope(previousScope);
|
||||
return switchFullySpecifiedType(previousType);
|
||||
}
|
||||
|
||||
SpecifierListAST *CheckSpecifier::switchSpecifier(SpecifierListAST *specifier)
|
||||
{
|
||||
SpecifierListAST *previousSpecifier = _specifier;
|
||||
|
||||
@@ -64,8 +64,6 @@ public:
|
||||
|
||||
FullySpecifiedType check(SpecifierListAST *specifier, Scope *scope,
|
||||
const FullySpecifiedType &ty = FullySpecifiedType());
|
||||
FullySpecifiedType check(ObjCTypeNameAST *typeName, Scope *scope,
|
||||
const FullySpecifiedType &ty = FullySpecifiedType());
|
||||
|
||||
protected:
|
||||
SpecifierListAST *switchSpecifier(SpecifierListAST *specifier);
|
||||
|
||||
@@ -169,10 +169,6 @@ FullySpecifiedType Semantic::check(PtrOperatorListAST *ptrOperators, const Fully
|
||||
FullySpecifiedType Semantic::check(ObjCMethodPrototypeAST *methodPrototype, Scope *scope)
|
||||
{ return d->checkDeclarator->check(methodPrototype, scope); }
|
||||
|
||||
FullySpecifiedType Semantic::check(ObjCTypeNameAST *typeName, Scope *scope,
|
||||
const FullySpecifiedType &type)
|
||||
{ return d->checkSpecifier->check(typeName, scope, type); }
|
||||
|
||||
void Semantic::check(ObjCMessageArgumentDeclarationAST *arg, Scope *scope)
|
||||
{ return d->checkName->check(arg, scope); }
|
||||
|
||||
|
||||
@@ -107,9 +107,6 @@ public:
|
||||
|
||||
const Name *check(NestedNameSpecifierListAST *name, Scope *scope);
|
||||
|
||||
FullySpecifiedType check(ObjCTypeNameAST *typeName, Scope *scope,
|
||||
const FullySpecifiedType &type = FullySpecifiedType());
|
||||
|
||||
void check(ObjCMessageArgumentDeclarationAST *arg, Scope *scope);
|
||||
|
||||
void checkFunctionDefinition(FunctionDefinitionAST *ast);
|
||||
|
||||
Reference in New Issue
Block a user