mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-20 15:20:09 +02:00
codetools: fixed TFindDeclarationTool.FindOverridenMethodDecl searching next ancestor
This commit is contained in:
parent
12afdd137b
commit
c36f3fe0a5
@ -12314,14 +12314,14 @@ begin
|
|||||||
end
|
end
|
||||||
else if Node.Desc in AllSimpleIdentifierDefinitions then begin
|
else if Node.Desc in AllSimpleIdentifierDefinitions then begin
|
||||||
if CompareIdentifiers(@CurTool.Src[Node.StartPos],Identifier)=0 then
|
if CompareIdentifiers(@CurTool.Src[Node.StartPos],Identifier)=0 then
|
||||||
exit;
|
exit; // ancestor has field or constant with same name -> stop
|
||||||
end else if Node.Desc=ctnProperty then begin
|
end else if Node.Desc=ctnProperty then begin
|
||||||
CurIdentifier:=GetPropertyNameIdentifier(Node);
|
CurIdentifier:=GetPropertyNameIdentifier(Node);
|
||||||
if CompareIdentifiers(CurIdentifier,Identifier)=0 then
|
if CompareIdentifiers(CurIdentifier,Identifier)=0 then
|
||||||
exit;
|
exit; // ancestor has property with same name -> stop
|
||||||
end else if Node.Desc=ctnProcedure then begin
|
end else if Node.Desc=ctnProcedure then begin
|
||||||
CurIdentifier:=CurTool.GetProcNameIdentifier(Node);
|
CurIdentifier:=CurTool.GetProcNameIdentifier(Node);
|
||||||
//debugln([' TFindDeclarationTool.FindOverridenMethodDecl PROC "',CurIdentifier,'"']);
|
//debugln([' TFindDeclarationTool.FindOverridenMethodDecl PROC "',GetIdentifier(CurIdentifier),'"']);
|
||||||
if CompareIdentifiers(CurIdentifier,Identifier)=0 then begin
|
if CompareIdentifiers(CurIdentifier,Identifier)=0 then begin
|
||||||
// found ancestor method with same name
|
// found ancestor method with same name
|
||||||
{$IFDEF VerboseFindRefMethodOverrides}
|
{$IFDEF VerboseFindRefMethodOverrides}
|
||||||
@ -12367,7 +12367,7 @@ begin
|
|||||||
end else if Node.Desc=ctnGenericType then begin
|
end else if Node.Desc=ctnGenericType then begin
|
||||||
if (Node.FirstChild<>nil)
|
if (Node.FirstChild<>nil)
|
||||||
and (CompareIdentifiers(@Src[Node.FirstChild.StartPos],Identifier)=0) then
|
and (CompareIdentifiers(@Src[Node.FirstChild.StartPos],Identifier)=0) then
|
||||||
exit;
|
exit; // ancestor has a generic type with same name -> stop
|
||||||
end;
|
end;
|
||||||
// next
|
// next
|
||||||
if Node.PriorBrother<>nil then
|
if Node.PriorBrother<>nil then
|
||||||
@ -12375,12 +12375,15 @@ begin
|
|||||||
else begin
|
else begin
|
||||||
repeat
|
repeat
|
||||||
Node:=Node.Parent;
|
Node:=Node.Parent;
|
||||||
if Node=ClassNode then exit;
|
if Node=ClassNode then begin
|
||||||
|
Node:=nil;
|
||||||
|
break;
|
||||||
|
end;
|
||||||
until Node.PriorBrother<>nil;
|
until Node.PriorBrother<>nil;
|
||||||
|
if Node=nil then break;
|
||||||
Node:=Node.PriorBrother;
|
Node:=Node.PriorBrother;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
finally
|
finally
|
||||||
|
@ -805,7 +805,9 @@ begin
|
|||||||
' TAnimal = class',
|
' TAnimal = class',
|
||||||
' procedure Fly{#Rename}; virtual;',
|
' procedure Fly{#Rename}; virtual;',
|
||||||
' end;',
|
' end;',
|
||||||
' TBird = class(TAnimal)',
|
' TFlying = class(TAnimal)',
|
||||||
|
' end;',
|
||||||
|
' TBird = class(TFlying)',
|
||||||
' procedure Eat;',
|
' procedure Eat;',
|
||||||
' procedure Fly; override;',
|
' procedure Fly; override;',
|
||||||
' end;',
|
' end;',
|
||||||
@ -840,7 +842,9 @@ begin
|
|||||||
' TAnimal = class',
|
' TAnimal = class',
|
||||||
' procedure Run{#Rename}; virtual;',
|
' procedure Run{#Rename}; virtual;',
|
||||||
' end;',
|
' end;',
|
||||||
' TBird = class(TAnimal)',
|
' TFlying = class(TAnimal)',
|
||||||
|
' end;',
|
||||||
|
' TBird = class(TFlying)',
|
||||||
' procedure Eat;',
|
' procedure Eat;',
|
||||||
' procedure Run; override;',
|
' procedure Run; override;',
|
||||||
' end;',
|
' end;',
|
||||||
|
Loading…
Reference in New Issue
Block a user