* 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 -
This commit is contained in:
marco 2013-03-09 22:07:33 +00:00
parent 21c154d60a
commit 39670e3454
2 changed files with 16 additions and 8 deletions

View File

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

View File

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