mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-21 11:49:57 +01:00
codetools: parse proc type with specialized function result
This commit is contained in:
parent
7c26a69c73
commit
d41a475c27
@ -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;
|
||||
|
||||
@ -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');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user