Explorar o código

* fixed 3 problems in fcl-passrc found when searching why fcl.chm
didn't build for 2.6.2
1. The nested function in findmemberancestors didn't set result.
Possibily sleeping bug triggered by -gttt
2. TPasmodule.Getelement crashed for some classes loaded from .xct
(code assuming they were pasmodule derivatives)
This probably touches a deeper lying problem where the
(new) classtree doesn't validate nodetypes properly, and loaded
classes end up as modules in one or the other overview
3. *Visibility functions had an out parameter that was not set
in all cases. Changed to VAR. (see mail fpc-devel from today).
Another -gttt sleeper bug.

(2) probably was the main problem of the initial crash.

git-svn-id: trunk@23760 -

marco %!s(int64=12) %!d(string=hai) anos
pai
achega
39670e3454
Modificáronse 2 ficheiros con 16 adicións e 8 borrados
  1. 13 5
      packages/fcl-passrc/src/pastree.pp
  2. 3 3
      packages/fcl-passrc/src/pparser.pp

+ 13 - 5
packages/fcl-passrc/src/pastree.pp

@@ -1393,9 +1393,9 @@ function TPasClassType.FindMemberInAncestors(MemberClass: TPTreeElement;
 
   begin
     if C.AncestorType is TPasClassType then
-      C:=TPasClassType(C.AncestorType)
+      result:=TPasClassType(C.AncestorType)
     else
-      C:=Nil;
+      result:=Nil;
   end;
 
 Var
@@ -1520,9 +1520,17 @@ begin
     Result := nil
   else
   begin
-    Result := TPasModule(Self);
-    while Assigned(Result) and not (Result is TPasModule) do
-      Result := TPasModule(Result.Parent);
+    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;
 end;
 

+ 3 - 3
packages/fcl-passrc/src/pparser.pp

@@ -157,7 +157,7 @@ type
     procedure ProcessMethod(AType: TPasClassType; IsClass : Boolean; AVisibility : TPasMemberVisibility);
     procedure ReadGenericArguments(List : TFPList;Parent : TPasElement);
     function CheckProcedureArgs(Parent: TPasElement; Args: TFPList; Mandatory: Boolean): boolean;
-    function CheckVisibility(S: String; out AVisibility: TPasMemberVisibility): Boolean;
+    function CheckVisibility(S: String; var AVisibility: TPasMemberVisibility): Boolean;
     procedure ParseExc(const Msg: String);
     function OpLevel(t: TToken): Integer;
     Function TokenToExprOp (AToken : TToken) : TExprOpCode;
@@ -3651,7 +3651,7 @@ begin
     end;
 end;
 
-Function IsVisibility(S : String;  Out AVisibility :TPasMemberVisibility) : Boolean;
+Function IsVisibility(S : String;  var AVisibility :TPasMemberVisibility) : Boolean;
 
 Const
   VNames : array[TPasMemberVisibility] of string =
@@ -3673,7 +3673,7 @@ begin
     end;
 end;
 
-Function TPasParser.CheckVisibility(S : String; Out AVisibility :TPasMemberVisibility) : Boolean;
+Function TPasParser.CheckVisibility(S : String; Var AVisibility :TPasMemberVisibility) : Boolean;
 
 Var
   B : Boolean;