diff --git a/components/codetools/pascalparsertool.pas b/components/codetools/pascalparsertool.pas index 4a7fabf994..b3b4bc068b 100644 --- a/components/codetools/pascalparsertool.pas +++ b/components/codetools/pascalparsertool.pas @@ -1443,7 +1443,6 @@ function TPascalParserTool.ReadTilProcedureHeadEnd( var HasForwardModifier: boolean): boolean; { parse parameter list, result type, of object, method specifiers - examples: procedure ProcName; virtual; abstract; function FuncName(Parameter1: Type1; Parameter2: Type2): ResultType; @@ -1459,7 +1458,7 @@ function TPascalParserTool.ReadTilProcedureHeadEnd( Delphi mode: Function TPOSControler.Logout; // missing function type - + function SomeMethod: IDictionary>; // generics proc specifiers without parameters: stdcall, virtual, abstract, dynamic, overload, override, cdecl, inline @@ -1535,23 +1534,22 @@ begin end; // Support generics in the function return type Level:=1; - if GetAtom='<' then - begin - ReadNextAtom; + if GetAtom='<' then begin while Level>0 do begin - AtomIsIdentifier(true); ReadNextAtom; - if CurPos.Flag=cafPoint then - Continue; - if CurPos.Flag=cafComma then - ReadNextAtom - else if GetAtom='<' then - Inc(Level) - else if GetAtom='>' then begin + if CurPos.Flag in [cafPoint, cafComma] then begin ReadNextAtom; + AtomIsIdentifier(true); + end + else if GetAtom='<' then begin + ReadNextAtom; + AtomIsIdentifier(true); + Inc(Level); + end + else if GetAtom='>' then Dec(Level); - end; end; + ReadNextAtom; end; end else begin if (Scanner.CompilerMode<>cmDelphi) then