From 0bb0793310ca33fec7cc478afbd717b9b4b3d99b Mon Sep 17 00:00:00 2001 From: mattias Date: Wed, 18 Jan 2012 14:02:54 +0000 Subject: [PATCH] codetools: do not search default class ancestor if there is another class ancestor git-svn-id: trunk@34777 - --- components/codetools/finddeclarationtool.pas | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/components/codetools/finddeclarationtool.pas b/components/codetools/finddeclarationtool.pas index 00cbbdaa67..a0fdd96596 100644 --- a/components/codetools/finddeclarationtool.pas +++ b/components/codetools/finddeclarationtool.pas @@ -4201,6 +4201,7 @@ var end; begin + //debugln(['TFindDeclarationTool.FindAncestorOfClass ',CleanPosToStr(ClassNode.StartPos,true)]); {$IFDEF CheckNodeTool}CheckNodeTool(ClassNode);{$ENDIF} if (ClassNode=nil) or (not (ClassNode.Desc in AllClasses)) then @@ -5558,22 +5559,30 @@ function TFindDeclarationTool.FindIdentifierInAncestors( var InheritanceNode: TCodeTreeNode; Node: TCodeTreeNode; + SearchDefaultAncestor: Boolean; begin Result:=false; if not (fdfSearchInAncestors in Params.Flags) then exit; + SearchDefaultAncestor:=true; InheritanceNode:=FindInheritanceNode(ClassNode); if (InheritanceNode<>nil) then begin Node:=InheritanceNode.FirstChild; while Node<>nil do begin if not FindAncestorOfClassInheritance(Node,Params,true) then exit; + if (ClassNode.Desc in AllClassInterfaces) + or (Params.NewNode.Desc in AllClassObjects) then + SearchDefaultAncestor:=false; if Search(Params.NewCodeTool,Params.NewNode) then exit(true); Node:=Node.NextBrother; end; end; - if not FindDefaultAncestorOfClass(ClassNode,Params,true) then exit; - Result:=Search(Params.NewCodeTool,Params.NewNode); + //debugln(['TFindDeclarationTool.FindIdentifierInAncestors SearchDefaultAncestor=',SearchDefaultAncestor,' ',CleanPosToStr(ClassNode.StartPos,true)]); + if not SearchDefaultAncestor then begin + if not FindDefaultAncestorOfClass(ClassNode,Params,true) then exit; + Result:=Search(Params.NewCodeTool,Params.NewNode); + end; end; {$IFDEF DebugPrefix}