fcl-passrc: fixed isspecialized test

git-svn-id: trunk@44387 -
This commit is contained in:
Mattias Gaertner 2020-03-28 16:32:10 +00:00
parent ef13f52ba8
commit 2ae212164e
2 changed files with 9 additions and 2 deletions

View File

@ -2324,6 +2324,7 @@ type
Params: TFPList): TPasElement; virtual; Params: TFPList): TPasElement; virtual;
procedure FinishSpecializedClassOrRecIntf(Scope: TPasGenericScope); virtual; procedure FinishSpecializedClassOrRecIntf(Scope: TPasGenericScope); virtual;
procedure FinishSpecializations(Scope: TPasGenericScope); virtual; procedure FinishSpecializations(Scope: TPasGenericScope); virtual;
function IsSpecialized(El: TPasGenericType): boolean; overload;
function IsFullySpecialized(El: TPasGenericType): boolean; overload; function IsFullySpecialized(El: TPasGenericType): boolean; overload;
function IsFullySpecialized(Proc: TPasProcedure): boolean; overload; function IsFullySpecialized(Proc: TPasProcedure): boolean; overload;
function IsInterfaceType(const ResolvedEl: TPasResolverResult; function IsInterfaceType(const ResolvedEl: TPasResolverResult;
@ -27943,7 +27944,7 @@ var
ProcScope: TPasProcedureScope; ProcScope: TPasProcedureScope;
begin begin
Result:=nil; Result:=nil;
if El.CustomData<>nil then if (El.ClassType=TPasSpecializeType) and (El.CustomData<>nil) then
RaiseNotYetImplemented(20190726142522,El); RaiseNotYetImplemented(20190726142522,El);
// check if there is already such a specialization // check if there is already such a specialization
@ -28099,6 +28100,12 @@ begin
SpecializeGenericImpl(TPRSpecializedItem(SpecializedItems[i])); SpecializeGenericImpl(TPRSpecializedItem(SpecializedItems[i]));
end; end;
function TPasResolver.IsSpecialized(El: TPasGenericType): boolean;
begin
Result:=(El<>nil) and (El.CustomData is TPasGenericScope)
and (TPasGenericScope(El.CustomData).SpecializedFromItem<>nil);
end;
function TPasResolver.IsFullySpecialized(El: TPasGenericType): boolean; function TPasResolver.IsFullySpecialized(El: TPasGenericType): boolean;
var var
GenScope: TPasGenericScope; GenScope: TPasGenericScope;

View File

@ -2981,7 +2981,7 @@ function TPasElement.GetModule: TPasModule;
Var Var
p : TPaselement; p : TPaselement;
begin begin
if self is TPasPackage then if Self is TPasPackage then
Result := nil Result := nil
else else
begin begin