mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-22 20:19:10 +02:00
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:
parent
c39bc40c24
commit
64ec2a7745
@ -838,7 +838,7 @@ function TPascalReaderTool.ExtractClassName(Node: TCodeTreeNode;
|
|||||||
var
|
var
|
||||||
ParamsNode: TCodeTreeNode;
|
ParamsNode: TCodeTreeNode;
|
||||||
ParamNode: TCodeTreeNode;
|
ParamNode: TCodeTreeNode;
|
||||||
First: Boolean;
|
Params: String;
|
||||||
begin
|
begin
|
||||||
Result:='';
|
Result:='';
|
||||||
while Node<>nil do begin
|
while Node<>nil do begin
|
||||||
@ -856,22 +856,19 @@ begin
|
|||||||
// extract generic type param names
|
// extract generic type param names
|
||||||
if WithGenericParams then begin
|
if WithGenericParams then begin
|
||||||
ParamsNode:=Node.FirstChild.NextBrother;
|
ParamsNode:=Node.FirstChild.NextBrother;
|
||||||
First:=true;
|
Params:='';
|
||||||
while ParamsNode<>nil do begin
|
while ParamsNode<>nil do begin
|
||||||
if ParamsNode.Desc=ctnGenericParams then begin
|
if ParamsNode.Desc=ctnGenericParams then begin
|
||||||
Result:='>'+Result;
|
|
||||||
ParamNode:=ParamsNode.FirstChild;
|
ParamNode:=ParamsNode.FirstChild;
|
||||||
while ParamNode<>nil do begin
|
while ParamNode<>nil do begin
|
||||||
if ParamNode.Desc=ctnGenericParameter then begin
|
if ParamNode.Desc=ctnGenericParameter then begin
|
||||||
if First then
|
if Params<>'' then
|
||||||
First:=false
|
Params:=Params+',';
|
||||||
else
|
Params:=Params+GetIdentifier(@Src[ParamNode.StartPos]);
|
||||||
Result:=','+Result;
|
|
||||||
Result:=GetIdentifier(@Src[ParamNode.StartPos])+Result;
|
|
||||||
end;
|
end;
|
||||||
ParamNode:=ParamNode.NextBrother;
|
ParamNode:=ParamNode.NextBrother;
|
||||||
end;
|
end;
|
||||||
Result:='<'+Result;
|
Result:='<'+Params+'>'+Result;
|
||||||
end;
|
end;
|
||||||
ParamsNode:=ParamsNode.NextBrother;
|
ParamsNode:=ParamsNode.NextBrother;
|
||||||
end;
|
end;
|
||||||
|
@ -423,7 +423,7 @@ begin
|
|||||||
'{$mode delphi}',
|
'{$mode delphi}',
|
||||||
'interface',
|
'interface',
|
||||||
'type',
|
'type',
|
||||||
' TBird<T: class> = class',
|
' TBird<T: class;U> = class',
|
||||||
' procedure DoIt;',
|
' procedure DoIt;',
|
||||||
' end;',
|
' end;',
|
||||||
'implementation',
|
'implementation',
|
||||||
@ -436,12 +436,12 @@ begin
|
|||||||
'',
|
'',
|
||||||
' { TBird }',
|
' { TBird }',
|
||||||
'',
|
'',
|
||||||
' TBird<T: class> = class',
|
' TBird<T: class;U> = class',
|
||||||
' procedure DoIt;',
|
' procedure DoIt;',
|
||||||
' end;',
|
' end;',
|
||||||
'implementation',
|
'implementation',
|
||||||
'',
|
'',
|
||||||
'procedure TBird<T>.DoIt;',
|
'procedure TBird<T, U>.DoIt;',
|
||||||
'begin',
|
'begin',
|
||||||
'',
|
'',
|
||||||
'end;',
|
'end;',
|
||||||
|
Loading…
Reference in New Issue
Block a user