codetools: fixed method jump from objfpc generic method body to decl

This commit is contained in:
mattias 2025-01-26 15:23:38 +01:00
parent b7aafac192
commit 2706cc285c
2 changed files with 7 additions and 3 deletions

View File

@ -47,7 +47,6 @@ uses
FileProcs, CodeTree, CodeToolsStrConsts, PascalParserTool, StdCodeTools,
KeywordFuncLists, BasicCodeTools, LinkScanner, CodeCache, PascalReaderTool;
type
{ TMethodJumpingCodeTool }
@ -93,7 +92,6 @@ type
procedure CalcMemSize(Stats: TCTMemStats); override;
end;
implementation
{ TMethodJumpingCodeTool }
@ -287,9 +285,13 @@ const
begin
Result:=false;
if SearchForProcNode=nil then exit;
if Scanner.CompilerMode=cmOBJFPC then begin
Include(SearchForProcAttr,phpWithoutGenericParams);
Include(SearchInProcAttr,phpWithoutGenericParams);
end;
SearchedProcHead:=ExtractProcHeadWithGroup(SearchForProcNode,SearchForProcAttr);
{$IFDEF CTDEBUG}
DebugLn('TMethodJumpingCodeTool.FindJumpPoint.FindBestProcNode Searching ',SearchForProcNode.DescAsString,' "',SearchedProcHead.Name,'" ',ProcHeadAttributesToStr(SearchForProcAttr));
DebugLn('TMethodJumpingCodeTool.FindJumpPoint.FindBestProcNode Searching ',SearchForProcNode.DescAsString,' "',dbgs(SearchedProcHead),'"');
{$ENDIF}
if SearchedProcHead.Name='' then exit;
ProcNode:=FindProcNode(StartNode,SearchedProcHead,SearchInProcAttr);

View File

@ -350,12 +350,14 @@ begin
'implementation',
'generic class function TBird.{b}Do2It<T>(s: T): T;',
'begin',
' {c}',
'end;',
'procedure TBird.DoIt;',
'begin',
'end;',
'end.']);
TestJumpToMethod('a',false,'b',false,2);
TestJumpToMethod('c',false,'a',false);
end;
procedure TTestMethodJumpTool.TestMethodJump_ParamWithAttribute;