Codetools: Improve support for generics in function return. Issue #20059

git-svn-id: trunk@32067 -
This commit is contained in:
juha 2011-08-27 07:21:28 +00:00
parent 827c9501e8
commit 49baf73873

View File

@ -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
ReadNextAtom;
if CurPos.Flag in [cafPoint, cafComma] then begin
ReadNextAtom;
AtomIsIdentifier(true); AtomIsIdentifier(true);
end
else if GetAtom='<' then begin
ReadNextAtom; ReadNextAtom;
if CurPos.Flag=cafPoint then AtomIsIdentifier(true);
Continue; Inc(Level);
if CurPos.Flag=cafComma then end
ReadNextAtom else if GetAtom='>' then
else if GetAtom='<' then
Inc(Level)
else if GetAtom='>' then begin
ReadNextAtom;
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