mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 18:19:34 +02:00
MG: jump to method in sub procs will now also try parent procs
git-svn-id: trunk@643 -
This commit is contained in:
parent
dac3b9e0a0
commit
77aab1fc38
@ -282,7 +282,7 @@ writeln('TMethodJumpingCodeTool.FindJumpPoint N ',DiffTxtPos);
|
|||||||
{$IFDEF CTDEBUG}
|
{$IFDEF CTDEBUG}
|
||||||
writeln('TMethodJumpingCodeTool.FindJumpPoint 2A ',ProcNode<>nil);
|
writeln('TMethodJumpingCodeTool.FindJumpPoint 2A ',ProcNode<>nil);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
if ProcNode<>nil then begin
|
while (ProcNode<>nil) and (ProcNode.Desc=ctnProcedure) do begin
|
||||||
if (ProcNode.SubDesc and ctnsForwardDeclaration)>0 then begin
|
if (ProcNode.SubDesc and ctnsForwardDeclaration)>0 then begin
|
||||||
// forward declaration -> search procedure
|
// forward declaration -> search procedure
|
||||||
{$IFDEF CTDEBUG}
|
{$IFDEF CTDEBUG}
|
||||||
@ -292,13 +292,9 @@ writeln('TMethodJumpingCodeTool.FindJumpPoint 2B ');
|
|||||||
// build the method name + parameter list (without default values)
|
// build the method name + parameter list (without default values)
|
||||||
Result:=FindBestProcNode(ProcNode,[phpInUpperCase],
|
Result:=FindBestProcNode(ProcNode,[phpInUpperCase],
|
||||||
ProcNode,[phpInUpperCase,phpIgnoreForwards]);
|
ProcNode,[phpInUpperCase,phpIgnoreForwards]);
|
||||||
// find good position in procedure body
|
exit;
|
||||||
{$IFDEF CTDEBUG}
|
|
||||||
writeln('TMethodJumpingCodeTool.FindJumpPoint 2D');
|
|
||||||
{$ENDIF}
|
|
||||||
//Result:=FindJumpPointInProcNode(ProcNode,NewPos,NewTopLine);
|
|
||||||
end else begin
|
end else begin
|
||||||
// procedure without forward, search on same level
|
// procedure is not forward, search on same proc level
|
||||||
{$IFDEF CTDEBUG}
|
{$IFDEF CTDEBUG}
|
||||||
writeln('TMethodJumpingCodeTool.FindJumpPoint 4A');
|
writeln('TMethodJumpingCodeTool.FindJumpPoint 4A');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
@ -328,10 +324,6 @@ writeln('TMethodJumpingCodeTool.FindJumpPoint 4D ',StartNode<>nil);
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
if StartNode=nil then exit;
|
if StartNode=nil then exit;
|
||||||
StartNode:=StartNode.FirstChild;
|
StartNode:=StartNode.FirstChild;
|
||||||
//SearchedProc:=ExtractProcHead(ProcNode,
|
|
||||||
// [phpWithoutClassName,phpInUpperCase]);
|
|
||||||
//if SearchedProc='' then exit;
|
|
||||||
//ProcNode:=FindProcNode(StartNode,SearchedProc,[phpInUpperCase]);
|
|
||||||
Result:=FindBestProcNode(ProcNode,[phpWithoutClassName,phpInUpperCase],
|
Result:=FindBestProcNode(ProcNode,[phpWithoutClassName,phpInUpperCase],
|
||||||
StartNode,[phpInUpperCase]);
|
StartNode,[phpInUpperCase]);
|
||||||
{$IFDEF CTDEBUG}
|
{$IFDEF CTDEBUG}
|
||||||
@ -370,19 +362,28 @@ writeln('TMethodJumpingCodeTool.FindJumpPoint 4G ',DiffNode<>nil);
|
|||||||
end else
|
end else
|
||||||
// find good position in procedure body
|
// find good position in procedure body
|
||||||
Result:=FindJumpPointInProcNode(ProcNode,NewPos,NewTopLine);
|
Result:=FindJumpPointInProcNode(ProcNode,NewPos,NewTopLine);
|
||||||
|
exit;
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
NodeExtMemManager.DisposeAVLTree(SearchForNodes);
|
NodeExtMemManager.DisposeAVLTree(SearchForNodes);
|
||||||
NodeExtMemManager.DisposeAVLTree(SearchInNodes);
|
NodeExtMemManager.DisposeAVLTree(SearchInNodes);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
exit;
|
||||||
end else begin
|
end else begin
|
||||||
// search forward procedure
|
// search forward procedure
|
||||||
Result:=FindBestProcNode(ProcNode,[phpInUpperCase],
|
Result:=FindBestProcNode(ProcNode,[phpInUpperCase],
|
||||||
StartNode,[phpInUpperCase,phpIgnoreProcsWithBody]);
|
StartNode,[phpInUpperCase,phpIgnoreProcsWithBody]);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
if Result then begin
|
||||||
|
exit;
|
||||||
|
end else begin
|
||||||
|
// no proc found
|
||||||
|
ProcNode:=ProcNode.Parent;
|
||||||
|
// try parent proc ...
|
||||||
|
end;
|
||||||
|
end; //while (ProcNode<>nil) and (ProcNode.Desc=ctnProcedure) do begin
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMethodJumpingCodeTool.FindJumpPointInProcNode(ProcNode: TCodeTreeNode;
|
function TMethodJumpingCodeTool.FindJumpPointInProcNode(ProcNode: TCodeTreeNode;
|
||||||
|
Loading…
Reference in New Issue
Block a user