mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-07 09:40:21 +02:00
codetools: fixed method jumping of generic class method
git-svn-id: trunk@50008 -
This commit is contained in:
parent
69ad3f134c
commit
a387dabeab
@ -34,7 +34,7 @@ interface
|
||||
|
||||
{$I codetools.inc}
|
||||
|
||||
{ $DEFINE CTDEBUG}
|
||||
{off $DEFINE CTDEBUG}
|
||||
|
||||
uses
|
||||
{$IFDEF MEM_CHECK}
|
||||
@ -281,7 +281,7 @@ const
|
||||
if SearchForProcNode=nil then exit;
|
||||
SearchedProcHead:=ExtractProcHeadWithGroup(SearchForProcNode,SearchForProcAttr);
|
||||
{$IFDEF CTDEBUG}
|
||||
DebugLn('TMethodJumpingCodeTool.FindJumpPoint.FindBestProcNode Searching ',SearchForProcNode.DescAsString,' "',SearchedProcHead.Head,'" ',ProcHeadAttributesToStr(SearchForProcAttr));
|
||||
DebugLn('TMethodJumpingCodeTool.FindJumpPoint.FindBestProcNode Searching ',SearchForProcNode.DescAsString,' "',SearchedProcHead.Name,'" ',ProcHeadAttributesToStr(SearchForProcAttr));
|
||||
{$ENDIF}
|
||||
if SearchedProcHead.Name='' then exit;
|
||||
ProcNode:=FindProcNode(StartNode,SearchedProcHead,SearchInProcAttr);
|
||||
@ -366,7 +366,7 @@ begin
|
||||
// and then jumping is a nide feature
|
||||
// => search in all implemented class procedures for the body
|
||||
{$IFDEF CTDEBUG}
|
||||
DebugLn('TMethodJumpingCodeTool.FindJumpPoint ClasNode=',ClassNode.DescAsString);
|
||||
DebugLn('TMethodJumpingCodeTool.FindJumpPoint ClassNode=',ClassNode.DescAsString);
|
||||
{$ENDIF}
|
||||
if (ClassNode.SubDesc and ctnsForwardDeclaration)>0 then exit;
|
||||
// parse class and build CodeTreeNodes for all properties/methods
|
||||
|
@ -187,7 +187,8 @@ type
|
||||
|
||||
// classes
|
||||
function ExtractClassName(Node: TCodeTreeNode;
|
||||
InUpperCase: boolean; WithParents: boolean = true): string;
|
||||
InUpperCase: boolean; WithParents: boolean = true;
|
||||
WithGenericParams: boolean = false): string;
|
||||
function ExtractClassPath(Node: TCodeTreeNode): string;
|
||||
function ExtractClassInheritance(ClassNode: TCodeTreeNode;
|
||||
Attr: TProcHeadAttributes): string;
|
||||
@ -763,7 +764,8 @@ begin
|
||||
end;
|
||||
|
||||
function TPascalReaderTool.ExtractClassName(Node: TCodeTreeNode;
|
||||
InUpperCase: boolean; WithParents: boolean): string;
|
||||
InUpperCase: boolean; WithParents: boolean; WithGenericParams: boolean
|
||||
): string;
|
||||
var
|
||||
ParamsNode: TCodeTreeNode;
|
||||
ParamNode: TCodeTreeNode;
|
||||
@ -781,28 +783,29 @@ begin
|
||||
ctnGenericType:
|
||||
begin
|
||||
if Result<>'' then Result:='.'+Result;
|
||||
if (Scanner.CompilerMode = cmDELPHI) and (Node.Desc = ctnGenericType)
|
||||
then begin
|
||||
if (Node.Desc = ctnGenericType) then begin
|
||||
// extract generic type param names
|
||||
ParamsNode:=Node.FirstChild.NextBrother;
|
||||
First:=true;
|
||||
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 WithGenericParams then begin
|
||||
ParamsNode:=Node.FirstChild.NextBrother;
|
||||
First:=true;
|
||||
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;
|
||||
end;
|
||||
ParamNode:=ParamNode.NextBrother;
|
||||
end;
|
||||
ParamNode:=ParamNode.NextBrother;
|
||||
Result:='<'+Result;
|
||||
end;
|
||||
Result:='<'+Result;
|
||||
ParamsNode:=ParamsNode.NextBrother;
|
||||
end;
|
||||
ParamsNode:=ParamsNode.NextBrother;
|
||||
end;
|
||||
Result:=GetIdentifier(@Src[Node.FirstChild.StartPos])+Result;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user