mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 18:19:08 +02:00
codetools: do not search default class ancestor if there is another class ancestor
git-svn-id: trunk@34777 -
This commit is contained in:
parent
bdd8d247fb
commit
0bb0793310
@ -4201,6 +4201,7 @@ var
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
//debugln(['TFindDeclarationTool.FindAncestorOfClass ',CleanPosToStr(ClassNode.StartPos,true)]);
|
||||||
{$IFDEF CheckNodeTool}CheckNodeTool(ClassNode);{$ENDIF}
|
{$IFDEF CheckNodeTool}CheckNodeTool(ClassNode);{$ENDIF}
|
||||||
if (ClassNode=nil) or (not (ClassNode.Desc in AllClasses))
|
if (ClassNode=nil) or (not (ClassNode.Desc in AllClasses))
|
||||||
then
|
then
|
||||||
@ -5558,22 +5559,30 @@ function TFindDeclarationTool.FindIdentifierInAncestors(
|
|||||||
var
|
var
|
||||||
InheritanceNode: TCodeTreeNode;
|
InheritanceNode: TCodeTreeNode;
|
||||||
Node: TCodeTreeNode;
|
Node: TCodeTreeNode;
|
||||||
|
SearchDefaultAncestor: Boolean;
|
||||||
begin
|
begin
|
||||||
Result:=false;
|
Result:=false;
|
||||||
|
|
||||||
if not (fdfSearchInAncestors in Params.Flags) then exit;
|
if not (fdfSearchInAncestors in Params.Flags) then exit;
|
||||||
|
|
||||||
|
SearchDefaultAncestor:=true;
|
||||||
InheritanceNode:=FindInheritanceNode(ClassNode);
|
InheritanceNode:=FindInheritanceNode(ClassNode);
|
||||||
if (InheritanceNode<>nil) then begin
|
if (InheritanceNode<>nil) then begin
|
||||||
Node:=InheritanceNode.FirstChild;
|
Node:=InheritanceNode.FirstChild;
|
||||||
while Node<>nil do begin
|
while Node<>nil do begin
|
||||||
if not FindAncestorOfClassInheritance(Node,Params,true) then exit;
|
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);
|
if Search(Params.NewCodeTool,Params.NewNode) then exit(true);
|
||||||
Node:=Node.NextBrother;
|
Node:=Node.NextBrother;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
if not FindDefaultAncestorOfClass(ClassNode,Params,true) then exit;
|
//debugln(['TFindDeclarationTool.FindIdentifierInAncestors SearchDefaultAncestor=',SearchDefaultAncestor,' ',CleanPosToStr(ClassNode.StartPos,true)]);
|
||||||
Result:=Search(Params.NewCodeTool,Params.NewNode);
|
if not SearchDefaultAncestor then begin
|
||||||
|
if not FindDefaultAncestorOfClass(ClassNode,Params,true) then exit;
|
||||||
|
Result:=Search(Params.NewCodeTool,Params.NewNode);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$IFDEF DebugPrefix}
|
{$IFDEF DebugPrefix}
|
||||||
|
Loading…
Reference in New Issue
Block a user