forked from qt-creator/qt-creator
Fixes for highlighting locals in Objective-C methods.
This commit is contained in:
@@ -155,6 +155,9 @@ private:
|
||||
virtual bool visit(Function *function)
|
||||
{ return processScope(function->members()); }
|
||||
|
||||
virtual bool visit(ObjCMethod *method)
|
||||
{ return processScope(method->members()); }
|
||||
|
||||
bool processScope(Scope *scope)
|
||||
{
|
||||
if (_scope || ! scope)
|
||||
@@ -258,9 +261,15 @@ protected:
|
||||
}
|
||||
|
||||
virtual bool visit(SimpleNameAST *ast)
|
||||
{ return findMemberForToken(ast->firstToken(), ast); }
|
||||
|
||||
virtual bool visit(ObjCMessageArgumentDeclarationAST *ast)
|
||||
{ return findMemberForToken(ast->param_name_token, ast); }
|
||||
|
||||
bool findMemberForToken(unsigned tokenIdx, NameAST *ast)
|
||||
{
|
||||
unsigned line, column;
|
||||
getTokenStartPosition(ast->firstToken(), &line, &column);
|
||||
getTokenStartPosition(tokenIdx, &line, &column);
|
||||
|
||||
Scope *scope = findScope(line, column,
|
||||
_functionScope->owner(),
|
||||
@@ -273,6 +282,12 @@ protected:
|
||||
return false;
|
||||
else if (findMember(fun->arguments(), ast, line, column))
|
||||
return false;
|
||||
} else if (scope->isObjCMethodScope()) {
|
||||
ObjCMethod *method = scope->owner()->asObjCMethod();
|
||||
if (findMember(method->members(), ast, line, column))
|
||||
return false;
|
||||
else if (findMember(method->arguments(), ast, line, column))
|
||||
return false;
|
||||
} else if (scope->isBlockScope()) {
|
||||
if (findMember(scope, ast, line, column))
|
||||
return false;
|
||||
@@ -395,6 +410,12 @@ protected:
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual bool visit(ObjCMethodPrototypeAST *ast)
|
||||
{
|
||||
accept(ast->argument_list);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user