diff --git a/components/codetools/pascalparsertool.pas b/components/codetools/pascalparsertool.pas index 2b3e5e7685..957d712dd7 100644 --- a/components/codetools/pascalparsertool.pas +++ b/components/codetools/pascalparsertool.pas @@ -1345,7 +1345,7 @@ begin CurNode.Desc:=ctnProcedureHead; CheckOperatorProc(ParseAttr); ReadNextAtom; - if Scanner.CompilerMode in [cmDELPHI,cmDELPHIUNICODE] then + if IsGeneric or (Scanner.CompilerMode in [cmDELPHI,cmDELPHIUNICODE]) then ReadGenericParamList(IsGeneric,true); if (CurPos.Flag<>cafPoint) then begin // read rest @@ -3696,7 +3696,18 @@ begin // read all type definitions Name = Type; or generic Name = Type; repeat ReadNextAtom; // name - if UpAtomIs('GENERIC') or AtomIsIdentifier then begin + if UpAtomIs('GENERIC') then begin + ReadNextAtom; + if UpAtomIs('CLASS') or UpAtomIs('PROCEDURE') or UpAtomIs('FUNCTION') then + begin + // generic function... -> not a type declaration + UndoReadNextAtom; + UndoReadNextAtom; + break; + end; + UndoReadNextAtom; + ReadTypeNameAndDefinition; + end else if AtomIsIdentifier then begin ReadTypeNameAndDefinition; end else if (CurPos.Flag=cafEdgedBracketOpen) and AllowAttributes then begin ReadAttribute;