diff --git a/Source/DelphiAST.pas b/Source/DelphiAST.pas index 4348e907..95f239b0 100644 --- a/Source/DelphiAST.pas +++ b/Source/DelphiAST.pas @@ -1461,19 +1461,28 @@ procedure TPasSyntaxTreeBuilder.FunctionMethodName; procedure TPasSyntaxTreeBuilder.FunctionProcedureName; var - ChildNode, NameNode, TypeParam, TypeNode, Temp: TSyntaxNode; + ChildNode, NameNode, TypeParamsNode, TypeParam, TypeNode, Temp: TSyntaxNode; FullName, TypeParams: string; begin FStack.Push(ntName); + TypeParamsNode := Nil; NameNode := FStack.Peek; try inherited; + TypeParams := ''; for ChildNode in NameNode.ChildNodes do begin + if TypeParams <> '' then + FullName := FullName + '<' + TypeParams + '>'; + + TypeParams := ''; + + TypeParamsNode := Nil; if ChildNode.Typ = ntTypeParams then begin + TypeParamsNode := ChildNode; TypeParams := ''; - + for TypeParam in ChildNode.ChildNodes do begin TypeNode := TypeParam.FindNode(ntType); @@ -1485,7 +1494,6 @@ procedure TPasSyntaxTreeBuilder.FunctionProcedureName; end; end; - FullName := FullName + '<' + TypeParams + '>'; Continue; end; @@ -1498,6 +1506,11 @@ procedure TPasSyntaxTreeBuilder.FunctionProcedureName; Temp := FStack.Peek; DoHandleString(FullName); Temp.SetAttribute(anName, FullName); + if Assigned(TypeParamsNode) then + begin + NameNode.ExtractChild(TypeParamsNode); + Temp.AddChild(TypeParamsNode); + end; Temp.DeleteChild(NameNode); end; end; diff --git a/Source/SimpleParser/SimpleParser.pas b/Source/SimpleParser/SimpleParser.pas index c39f44f2..d89a1292 100644 --- a/Source/SimpleParser/SimpleParser.pas +++ b/Source/SimpleParser/SimpleParser.pas @@ -2048,7 +2048,7 @@ procedure TmwSimplePasPar.FunctionMethodDeclaration; else begin Expected(ptColon); - ReturnType; + ReturnType; FunctionProcedureBlock; end; end; @@ -2119,7 +2119,7 @@ procedure TmwSimplePasPar.FunctionProcedureBlock; end; if HasBlock then - begin + begin case TokenID of ptAsm: begin @@ -4412,7 +4412,7 @@ procedure TmwSimplePasPar.ExplicitType; end; procedure TmwSimplePasPar.TypeKind; -begin +begin case TokenID of ptAsciiChar, ptFloat, ptIntegerConst, ptMinus, ptNil, ptPlus, ptStringConst, ptConst: begin @@ -4678,7 +4678,7 @@ procedure TmwSimplePasPar.ProcedureDeclarationSection; else begin SynError(InvalidProcedureDeclarationSection); - end; + end; end; end; @@ -5746,4 +5746,4 @@ procedure TmwSimplePasPar.CustomAttribute; AttributeSections; end; -end. \ No newline at end of file +end.