mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 10:36:01 +02:00
Codetools: Improve support for generics in function return. Issue #20059
git-svn-id: trunk@32067 -
This commit is contained in:
parent
827c9501e8
commit
49baf73873
@ -1443,7 +1443,6 @@ function TPascalParserTool.ReadTilProcedureHeadEnd(
|
|||||||
var HasForwardModifier: boolean): boolean;
|
var HasForwardModifier: boolean): boolean;
|
||||||
{ parse parameter list, result type, of object, method specifiers
|
{ parse parameter list, result type, of object, method specifiers
|
||||||
|
|
||||||
|
|
||||||
examples:
|
examples:
|
||||||
procedure ProcName; virtual; abstract;
|
procedure ProcName; virtual; abstract;
|
||||||
function FuncName(Parameter1: Type1; Parameter2: Type2): ResultType;
|
function FuncName(Parameter1: Type1; Parameter2: Type2): ResultType;
|
||||||
@ -1459,7 +1458,7 @@ function TPascalParserTool.ReadTilProcedureHeadEnd(
|
|||||||
|
|
||||||
Delphi mode:
|
Delphi mode:
|
||||||
Function TPOSControler.Logout; // missing function type
|
Function TPOSControler.Logout; // missing function type
|
||||||
|
function SomeMethod: IDictionary<string, IDictionary<K, V>>; // generics
|
||||||
|
|
||||||
proc specifiers without parameters:
|
proc specifiers without parameters:
|
||||||
stdcall, virtual, abstract, dynamic, overload, override, cdecl, inline
|
stdcall, virtual, abstract, dynamic, overload, override, cdecl, inline
|
||||||
@ -1535,23 +1534,22 @@ begin
|
|||||||
end;
|
end;
|
||||||
// Support generics in the function return type
|
// Support generics in the function return type
|
||||||
Level:=1;
|
Level:=1;
|
||||||
if GetAtom='<' then
|
if GetAtom='<' then begin
|
||||||
begin
|
|
||||||
ReadNextAtom;
|
|
||||||
while Level>0 do begin
|
while Level>0 do begin
|
||||||
AtomIsIdentifier(true);
|
|
||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
if CurPos.Flag=cafPoint then
|
if CurPos.Flag in [cafPoint, cafComma] then begin
|
||||||
Continue;
|
|
||||||
if CurPos.Flag=cafComma then
|
|
||||||
ReadNextAtom
|
|
||||||
else if GetAtom='<' then
|
|
||||||
Inc(Level)
|
|
||||||
else if GetAtom='>' then begin
|
|
||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
|
AtomIsIdentifier(true);
|
||||||
|
end
|
||||||
|
else if GetAtom='<' then begin
|
||||||
|
ReadNextAtom;
|
||||||
|
AtomIsIdentifier(true);
|
||||||
|
Inc(Level);
|
||||||
|
end
|
||||||
|
else if GetAtom='>' then
|
||||||
Dec(Level);
|
Dec(Level);
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
ReadNextAtom;
|
||||||
end;
|
end;
|
||||||
end else begin
|
end else begin
|
||||||
if (Scanner.CompilerMode<>cmDelphi) then
|
if (Scanner.CompilerMode<>cmDelphi) then
|
||||||
|
Loading…
Reference in New Issue
Block a user