codetools: parse proc type with specialized function result

This commit is contained in:
mattias 2023-08-05 11:09:53 +02:00
parent 7c26a69c73
commit d41a475c27
2 changed files with 27 additions and 12 deletions

View File

@ -4965,18 +4965,7 @@ begin
if IsFunction then begin
if (CurPos.Flag=cafColon) then begin
ReadNextAtom;
if UpAtomIs('SPECIALIZE') then begin
ReadSpecialize(true);
end
else begin
AtomIsIdentifierSaveE(20180411194218);
ReadNextAtom;
end;
if CurPos.Flag=cafPoint then begin
ReadNextAtom;
AtomIsIdentifierSaveE(20180411194221);
ReadNextAtom;
end;
ReadTypeReference(true);
end else begin
SaveRaiseCharExpectedButAtomFound(20170421195810,':');
end;

View File

@ -126,6 +126,7 @@ type
procedure TestFindDeclaration_Generics_FindDeclaration;
procedure TestFindDeclaration_GenericsDelphi_InterfaceAncestor;
procedure TestFindDeclaration_GenericsDelphi_FuncParam;
procedure TestFindDeclaration_GenericsDelphi_PublicProcType;
procedure TestFindDeclaration_ForIn;
procedure TestFindDeclaration_FileAtCursor;
procedure TestFindDeclaration_CBlocks;
@ -841,6 +842,31 @@ begin
FindDeclarations(Code);
end;
procedure TTestFindDeclaration.
TestFindDeclaration_GenericsDelphi_PublicProcType;
begin
StartProgram;
Add([
'{$mode delphi}',
'type',
' TArray<T> = array of T;',
' TWing = class',
' end;',
' TBird = class',
' public type',
' TFlyFunc<T: TWing> = function (AType: TObject): TArray<T>;',
' public var Fly: TFlyFunc<TWing>;',
' end;',
'function Run(Sender: TObject): TArray<TWing>;',
'begin',
'end;',
'var Bird: TBird;',
'begin',
' Bird.Fly(nil);',
'end.']);
FindDeclarations(Code);
end;
procedure TTestFindDeclaration.TestFindDeclaration_ForIn;
begin
FindDeclarations('moduletests/fdt_for_in.pas');