codetools: fixed extract generic type param names, issue #37081, from Pascal Riekenberg

git-svn-id: branches/fixes_2_0@63490 -
This commit is contained in:
mattias 2020-07-03 10:13:28 +00:00
parent c39bc40c24
commit 64ec2a7745
2 changed files with 9 additions and 12 deletions

View File

@ -838,7 +838,7 @@ function TPascalReaderTool.ExtractClassName(Node: TCodeTreeNode;
var
ParamsNode: TCodeTreeNode;
ParamNode: TCodeTreeNode;
First: Boolean;
Params: String;
begin
Result:='';
while Node<>nil do begin
@ -856,22 +856,19 @@ begin
// extract generic type param names
if WithGenericParams then begin
ParamsNode:=Node.FirstChild.NextBrother;
First:=true;
Params:='';
while ParamsNode<>nil do begin
if ParamsNode.Desc=ctnGenericParams then begin
Result:='>'+Result;
ParamNode:=ParamsNode.FirstChild;
while ParamNode<>nil do begin
if ParamNode.Desc=ctnGenericParameter then begin
if First then
First:=false
else
Result:=','+Result;
Result:=GetIdentifier(@Src[ParamNode.StartPos])+Result;
if Params<>'' then
Params:=Params+',';
Params:=Params+GetIdentifier(@Src[ParamNode.StartPos]);
end;
ParamNode:=ParamNode.NextBrother;
end;
Result:='<'+Result;
Result:='<'+Params+'>'+Result;
end;
ParamsNode:=ParamsNode.NextBrother;
end;

View File

@ -423,7 +423,7 @@ begin
'{$mode delphi}',
'interface',
'type',
' TBird<T: class> = class',
' TBird<T: class;U> = class',
' procedure DoIt;',
' end;',
'implementation',
@ -436,12 +436,12 @@ begin
'',
' { TBird }',
'',
' TBird<T: class> = class',
' TBird<T: class;U> = class',
' procedure DoIt;',
' end;',
'implementation',
'',
'procedure TBird<T>.DoIt;',
'procedure TBird<T, U>.DoIt;',
'begin',
'',
'end;',