mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-22 07:30:24 +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 IsFunction then begin
|
||||||
if (CurPos.Flag=cafColon) then begin
|
if (CurPos.Flag=cafColon) then begin
|
||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
if UpAtomIs('SPECIALIZE') then begin
|
ReadTypeReference(true);
|
||||||
ReadSpecialize(true);
|
|
||||||
end
|
|
||||||
else begin
|
|
||||||
AtomIsIdentifierSaveE(20180411194218);
|
|
||||||
ReadNextAtom;
|
|
||||||
end;
|
|
||||||
if CurPos.Flag=cafPoint then begin
|
|
||||||
ReadNextAtom;
|
|
||||||
AtomIsIdentifierSaveE(20180411194221);
|
|
||||||
ReadNextAtom;
|
|
||||||
end;
|
|
||||||
end else begin
|
end else begin
|
||||||
SaveRaiseCharExpectedButAtomFound(20170421195810,':');
|
SaveRaiseCharExpectedButAtomFound(20170421195810,':');
|
||||||
end;
|
end;
|
||||||
|
|||||||
@ -126,6 +126,7 @@ type
|
|||||||
procedure TestFindDeclaration_Generics_FindDeclaration;
|
procedure TestFindDeclaration_Generics_FindDeclaration;
|
||||||
procedure TestFindDeclaration_GenericsDelphi_InterfaceAncestor;
|
procedure TestFindDeclaration_GenericsDelphi_InterfaceAncestor;
|
||||||
procedure TestFindDeclaration_GenericsDelphi_FuncParam;
|
procedure TestFindDeclaration_GenericsDelphi_FuncParam;
|
||||||
|
procedure TestFindDeclaration_GenericsDelphi_PublicProcType;
|
||||||
procedure TestFindDeclaration_ForIn;
|
procedure TestFindDeclaration_ForIn;
|
||||||
procedure TestFindDeclaration_FileAtCursor;
|
procedure TestFindDeclaration_FileAtCursor;
|
||||||
procedure TestFindDeclaration_CBlocks;
|
procedure TestFindDeclaration_CBlocks;
|
||||||
@ -841,6 +842,31 @@ begin
|
|||||||
FindDeclarations(Code);
|
FindDeclarations(Code);
|
||||||
end;
|
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;
|
procedure TTestFindDeclaration.TestFindDeclaration_ForIn;
|
||||||
begin
|
begin
|
||||||
FindDeclarations('moduletests/fdt_for_in.pas');
|
FindDeclarations('moduletests/fdt_for_in.pas');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user