diff --git a/components/codetools/codecompletiontool.pas b/components/codetools/codecompletiontool.pas index 04c75a2018..08f3b4189b 100644 --- a/components/codetools/codecompletiontool.pas +++ b/components/codetools/codecompletiontool.pas @@ -1747,10 +1747,11 @@ begin try // gather all proc definitions StartNode:=nil; - if (ProcNode.Parent.Desc=ctnImplementation) - and (ProcNode.Parent.PriorBrother<>nil) - and (ProcNode.Parent.PriorBrother.Desc=ctnInterface) then - StartNode:=ProcNode.Parent.PriorBrother.FirstChild; + if (ProcNode.Parent.Desc=ctnImplementation) then begin + StartNode:=FindInterfaceNode; + if StartNode<>nil then + StartNode:=StartNode.FirstChild; + end; if StartNode=nil then StartNode:=FindFirstNodeOnSameLvl(ProcNode); //debugln(['TCodeCompletionCodeTool.CompleteForwardProcs StartNode=',StartNode.DescAsString,' at ',CleanPosToStr(StartNode.StartPos),'=',ExtractProcName(StartNode,[])]); diff --git a/components/codetools/pascalparsertool.pas b/components/codetools/pascalparsertool.pas index e325239b06..b722d65c43 100644 --- a/components/codetools/pascalparsertool.pas +++ b/components/codetools/pascalparsertool.pas @@ -5501,11 +5501,11 @@ begin Result:=Result.PriorBrother; end else begin Result:=Result.Parent; - while (Result.Desc in AllCodeSections) and (Result.PriorBrother<>nil) do - Result:=Result.PriorBrother; - while (Result<>nil) and (Result.FirstChild=nil) do - Result:=Result.NextBrother; - Result:=Result.FirstChild; + if (Result.Desc=ctnImplementation) and (Result.PriorBrother.Desc=ctnInterface) + and (Result.PriorBrother.FirstChild<>nil) then + Result:=Result.PriorBrother.FirstChild + else + Result:=Result.FirstChild; end; end;