mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-27 16:20:35 +02:00
codetools: fixed FindMethodNodeInImplementation for program
git-svn-id: trunk@36969 -
This commit is contained in:
parent
c7543c32cb
commit
ca20fbb994
@ -483,32 +483,36 @@ begin
|
||||
if (AMethodName='') or (AClassName='') then exit;
|
||||
if BuildTreeBefore then BuildTree(lsrEnd);
|
||||
// find implementation node
|
||||
SectionNode:=FindImplementationNode;
|
||||
if SectionNode=nil then exit;
|
||||
ANode:=SectionNode.FirstChild;
|
||||
{$IFDEF CTDEBUG}
|
||||
DebugLn('[TEventsCodeTool.FindMethodNodeInImplementation] A AMethodName=',AClassName,'.',AMethodName);
|
||||
{$ENDIF}
|
||||
while (ANode<>nil) do begin
|
||||
if (ANode.Desc=ctnProcedure) and (ANode.FirstChild<>nil)
|
||||
and CompareSrcIdentifiers(ANode.FirstChild.StartPos,@AClassName[1])
|
||||
then begin
|
||||
MoveCursorToNodeStart(ANode.FirstChild);
|
||||
ReadNextAtom; // read class name
|
||||
ReadNextAtom; // read '.'
|
||||
if AtomIsChar('.') then begin
|
||||
ReadNextAtom;
|
||||
if CompareSrcIdentifiers(CurPos.StartPos,@AMethodName[1]) then
|
||||
begin
|
||||
{$IFDEF CTDEBUG}
|
||||
DebugLn('[TEventsCodeTool.FindMethodNodeInImplementation] B body found');
|
||||
{$ENDIF}
|
||||
Result:=ANode;
|
||||
exit;
|
||||
SectionNode:=Tree.Root;
|
||||
while SectionNode<>nil do begin
|
||||
if SectionNode.Desc in [ctnProgram,ctnImplementation] then begin
|
||||
ANode:=SectionNode.FirstChild;
|
||||
{$IFDEF CTDEBUG}
|
||||
DebugLn('[TEventsCodeTool.FindMethodNodeInImplementation] A AMethodName=',AClassName,'.',AMethodName);
|
||||
{$ENDIF}
|
||||
while (ANode<>nil) do begin
|
||||
if (ANode.Desc=ctnProcedure) and (ANode.FirstChild<>nil)
|
||||
and CompareSrcIdentifiers(ANode.FirstChild.StartPos,@AClassName[1])
|
||||
then begin
|
||||
MoveCursorToNodeStart(ANode.FirstChild);
|
||||
ReadNextAtom; // read class name
|
||||
ReadNextAtom; // read '.'
|
||||
if AtomIsChar('.') then begin
|
||||
ReadNextAtom;
|
||||
if CompareSrcIdentifiers(CurPos.StartPos,@AMethodName[1]) then
|
||||
begin
|
||||
{$IFDEF CTDEBUG}
|
||||
DebugLn('[TEventsCodeTool.FindMethodNodeInImplementation] B body found');
|
||||
{$ENDIF}
|
||||
Result:=ANode;
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
ANode:=ANode.NextBrother;
|
||||
end;
|
||||
end;
|
||||
ANode:=ANode.NextBrother;
|
||||
SectionNode:=SectionNode.NextBrother;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user