mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-10 14:56:00 +02:00
codetools: fixed FindDeclarationAndOverloads on interface function
git-svn-id: trunk@53871 -
This commit is contained in:
parent
b26395674d
commit
baa0147222
Binary file not shown.
@ -66,6 +66,7 @@ interface
|
|||||||
{ $DEFINE VerboseFindDeclarationFail}
|
{ $DEFINE VerboseFindDeclarationFail}
|
||||||
{ $DEFINE DebugAddToolDependency}
|
{ $DEFINE DebugAddToolDependency}
|
||||||
{ $DEFINE VerboseCPS}
|
{ $DEFINE VerboseCPS}
|
||||||
|
{ $DEFINE VerboseFindDeclarationAndOverload}
|
||||||
|
|
||||||
{$IFDEF CTDEBUG}{$DEFINE DebugPrefix}{$ENDIF}
|
{$IFDEF CTDEBUG}{$DEFINE DebugPrefix}{$ENDIF}
|
||||||
{$IFDEF ShowTriedIdentifiers}{$DEFINE DebugPrefix}{$ENDIF}
|
{$IFDEF ShowTriedIdentifiers}{$DEFINE DebugPrefix}{$ENDIF}
|
||||||
@ -5533,22 +5534,38 @@ var
|
|||||||
procedure AddPos;
|
procedure AddPos;
|
||||||
begin
|
begin
|
||||||
AddCodePosition(OldPositions,NewPos);
|
AddCodePosition(OldPositions,NewPos);
|
||||||
if (NodeList.IndexOf(NewNode)>=0) then
|
if (NodeList.IndexOf(NewNode)>=0) then begin
|
||||||
|
{$IFDEF VerboseFindDeclarationAndOverload}
|
||||||
|
debugln(['AddPos skip, because Node already in NodList']);
|
||||||
|
{$ENDIF}
|
||||||
exit;
|
exit;
|
||||||
|
end;
|
||||||
NodeList.Add(NewNode);
|
NodeList.Add(NewNode);
|
||||||
|
|
||||||
if (fdlfWithoutEmptyProperties in Flags)
|
if (fdlfWithoutEmptyProperties in Flags)
|
||||||
and (NewNode.Desc=ctnProperty)
|
and (NewNode.Desc=ctnProperty)
|
||||||
and (NewTool.PropNodeIsTypeLess(NewNode)) then
|
and (NewTool.PropNodeIsTypeLess(NewNode)) then begin
|
||||||
|
{$IFDEF VerboseFindDeclarationAndOverload}
|
||||||
|
debugln(['AddPos skip, because property has no type']);
|
||||||
|
{$ENDIF}
|
||||||
exit;
|
exit;
|
||||||
|
end;
|
||||||
if (fdlfWithoutForwards in Flags) then begin
|
if (fdlfWithoutForwards in Flags) then begin
|
||||||
if (NewNode.Desc in [ctnTypeDefinition,ctnGenericType])
|
if (NewNode.Desc in [ctnTypeDefinition,ctnGenericType])
|
||||||
and NewTool.NodeIsForwardDeclaration(NewNode)
|
and NewTool.NodeIsForwardDeclaration(NewNode) then begin
|
||||||
then
|
{$IFDEF VerboseFindDeclarationAndOverload}
|
||||||
|
debugln(['AddPos skip, because type is forward']);
|
||||||
|
{$ENDIF}
|
||||||
exit;
|
exit;
|
||||||
|
end;
|
||||||
if (NewNode.Desc=ctnProcedure)
|
if (NewNode.Desc=ctnProcedure)
|
||||||
and ((NewNode.SubDesc and ctnsForwardDeclaration)>0) then
|
and ((NewNode.SubDesc and ctnsForwardDeclaration)>0)
|
||||||
|
and (not NewNode.HasParentOfType(ctnInterface)) then begin
|
||||||
|
{$IFDEF VerboseFindDeclarationAndOverload}
|
||||||
|
debugln(['AddPos skip, because proc is forward']);
|
||||||
|
{$ENDIF}
|
||||||
exit;
|
exit;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
AddCodePosition(ListOfPCodeXYPosition,NewPos);
|
AddCodePosition(ListOfPCodeXYPosition,NewPos);
|
||||||
end;
|
end;
|
||||||
@ -5594,6 +5611,9 @@ var
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
{$IFDEF VerboseFindDeclarationAndOverload}
|
||||||
|
debugln(['TFindDeclarationTool.FindDeclarationAndOverload START']);
|
||||||
|
{$ENDIF}
|
||||||
Result:=true;
|
Result:=true;
|
||||||
ListOfPCodeXYPosition:=nil;
|
ListOfPCodeXYPosition:=nil;
|
||||||
NewTool:=nil;
|
NewTool:=nil;
|
||||||
@ -5612,15 +5632,26 @@ begin
|
|||||||
AtDefinition:=StartPositionAtDefinition;
|
AtDefinition:=StartPositionAtDefinition;
|
||||||
if AtDefinition then begin
|
if AtDefinition then begin
|
||||||
AddPos;
|
AddPos;
|
||||||
if fdlfIfStartIsDefinitionStop in Flags then exit;
|
if fdlfIfStartIsDefinitionStop in Flags then begin
|
||||||
|
{$IFDEF VerboseFindDeclarationAndOverload}
|
||||||
|
debugln(['TFindDeclarationTool.FindDeclarationAndOverload AtDefiniton and fdlfIfStartIsDefinitionStop in Flags']);
|
||||||
|
{$ENDIF}
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
if StartPositionAtFunctionResult then begin
|
if StartPositionAtFunctionResult then begin
|
||||||
AddPos;
|
AddPos;
|
||||||
// the function result has no overloads => stop search
|
// the function result has no overloads => stop search
|
||||||
|
{$IFDEF VerboseFindDeclarationAndOverload}
|
||||||
|
debugln(['TFindDeclarationTool.FindDeclarationAndOverload function result has no overloads']);
|
||||||
|
{$ENDIF}
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
if NewNode.Desc in AllSourceTypes then begin
|
if NewNode.Desc in AllSourceTypes then begin
|
||||||
// the unit name has no overloads => stop search
|
// the unit name has no overloads => stop search
|
||||||
|
{$IFDEF VerboseFindDeclarationAndOverload}
|
||||||
|
debugln(['TFindDeclarationTool.FindDeclarationAndOverload unit name has no overload']);
|
||||||
|
{$ENDIF}
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -5635,11 +5666,13 @@ begin
|
|||||||
AddPos;
|
AddPos;
|
||||||
CurCursorPos:=NewPos;
|
CurCursorPos:=NewPos;
|
||||||
CurTool:=NewTool;
|
CurTool:=NewTool;
|
||||||
{debugln('TFindDeclarationTool.FindDeclarationAndOverload Self="',MainFilename,'" ');
|
{$IFDEF VerboseFindDeclarationAndOverload}
|
||||||
|
debugln('TFindDeclarationTool.FindDeclarationAndOverload Self="',MainFilename,'" ');
|
||||||
if CurCursorPos.Code<>nil then
|
if CurCursorPos.Code<>nil then
|
||||||
debugln(' CurCursorPos=',CurCursorPos.Code.Filename,' ',dbgs(CurCursorPos.X),',',dbgs(CurCursorPos.Y));
|
debugln(' CurCursorPos=',CurCursorPos.Code.Filename,' ',dbgs(CurCursorPos.X),',',dbgs(CurCursorPos.Y));
|
||||||
if CurTool<>nil then
|
if CurTool<>nil then
|
||||||
debugln(' CurTool=',CurTool.MainFilename);}
|
debugln(' CurTool=',CurTool.MainFilename);
|
||||||
|
{$ENDIF}
|
||||||
if (CurTool=nil) then exit;
|
if (CurTool=nil) then exit;
|
||||||
end;
|
end;
|
||||||
except
|
except
|
||||||
|
Loading…
Reference in New Issue
Block a user