From 98e70ae3e65cbe37f0c995ed43b22b6e5161ef6e Mon Sep 17 00:00:00 2001 From: michael Date: Sun, 26 Jul 2015 11:40:28 +0000 Subject: [PATCH] * Fix GetModule, cause of wrong class tree git-svn-id: trunk@31235 - --- packages/fcl-passrc/src/pastree.pp | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/packages/fcl-passrc/src/pastree.pp b/packages/fcl-passrc/src/pastree.pp index 16bb522a93..30ae07f85b 100644 --- a/packages/fcl-passrc/src/pastree.pp +++ b/packages/fcl-passrc/src/pastree.pp @@ -1743,23 +1743,19 @@ begin end; function TPasElement.GetModule: TPasModule; + +Var + p : TPaselement; begin if self is TPasPackage then Result := nil else - begin - if self is TPasModule then - begin - Result := TPasModule(Self); - while Assigned(Result) and not (Result is TPasModule) do - Result := TPasModule(Result.Parent); - end - else - begin - // typical case that this happens: symbol was loaded from .XCT - result:=nil; - end; - end; + begin + P:=Self; + While (P<>Nil) and Not (P is TPasModule) do + P:=P.Parent; + Result:=TPasModule(P); + end; end; function TPasElement.GetDeclaration(full: Boolean): string;