fcl-passrc: resolver: FinishedInterfaceIndex

git-svn-id: trunk@46508 -
This commit is contained in:
Mattias Gaertner 2020-08-20 13:26:09 +00:00
parent ac36a214bf
commit dacf740561

View File

@ -1433,7 +1433,9 @@ type
private private
FOwner: TObject; FOwner: TObject;
public public
constructor Create(TheOwner: TObject); FinishedInterfaceCount: integer;
constructor Create(TheOwner: TObject); virtual;
procedure Reset; virtual;
property Owner: TObject read FOwner; property Owner: TObject read FOwner;
end; end;
TPasResolverHubClass = class of TPasResolverHub; TPasResolverHubClass = class of TPasResolverHub;
@ -1491,6 +1493,7 @@ type
FDefaultScope: TPasDefaultScope; FDefaultScope: TPasDefaultScope;
FDynArrayMaxIndex: TMaxPrecInt; FDynArrayMaxIndex: TMaxPrecInt;
FDynArrayMinIndex: TMaxPrecInt; FDynArrayMinIndex: TMaxPrecInt;
FFinishedInterfaceIndex: integer;
FHub: TPasResolverHub; FHub: TPasResolverHub;
FLastCreatedData: array[TResolveDataListKind] of TResolveData; FLastCreatedData: array[TResolveDataListKind] of TResolveData;
FLastElement: TPasElement; FLastElement: TPasElement;
@ -2268,6 +2271,7 @@ type
PosEl: TPasElement; RaiseIfConst: boolean = true): boolean; PosEl: TPasElement; RaiseIfConst: boolean = true): boolean;
function ResolvedElIsClassOrRecordInstance(const ResolvedEl: TPasResolverResult): boolean; function ResolvedElIsClassOrRecordInstance(const ResolvedEl: TPasResolverResult): boolean;
// utility functions // utility functions
function GetResolver(El: TPasElement): TPasResolver;
function ElHasModeSwitch(El: TPasElement; ms: TModeSwitch): boolean; function ElHasModeSwitch(El: TPasElement; ms: TModeSwitch): boolean;
function GetElModeSwitches(El: TPasElement): TModeSwitches; function GetElModeSwitches(El: TPasElement): TModeSwitches;
function ElHasBoolSwitch(El: TPasElement; bs: TBoolSwitch): boolean; function ElHasBoolSwitch(El: TPasElement; bs: TBoolSwitch): boolean;
@ -2403,6 +2407,7 @@ type
property RootElement: TPasModule read FRootElement write SetRootElement; property RootElement: TPasModule read FRootElement write SetRootElement;
property Step: TPasResolverStep read FStep; property Step: TPasResolverStep read FStep;
property ActiveHelpers: TPRHelperEntryArray read FActiveHelpers; property ActiveHelpers: TPRHelperEntryArray read FActiveHelpers;
property FinishedInterfaceIndex: integer read FFinishedInterfaceIndex;
// scopes // scopes
property Scopes[Index: integer]: TPasScope read GetScopes; property Scopes[Index: integer]: TPasScope read GetScopes;
property ScopeCount: integer read FScopeCount; property ScopeCount: integer read FScopeCount;
@ -3084,6 +3089,11 @@ begin
FOwner:=TheOwner; FOwner:=TheOwner;
end; end;
procedure TPasResolverHub.Reset;
begin
FinishedInterfaceCount:=0;
end;
{ TPRSpecializedItem } { TPRSpecializedItem }
destructor TPRSpecializedItem.Destroy; destructor TPRSpecializedItem.Destroy;
@ -5844,6 +5854,8 @@ begin
if not IsUnitIntfFinished(Section.GetModule) then if not IsUnitIntfFinished(Section.GetModule) then
RaiseInternalError(20171214004323,'TPasResolver.FinishInterfaceSection "'+RootElement.Name+'" "'+Section.GetModule.Name+'" IsUnitIntfFinished=false'); RaiseInternalError(20171214004323,'TPasResolver.FinishInterfaceSection "'+RootElement.Name+'" "'+Section.GetModule.Name+'" IsUnitIntfFinished=false');
{$ENDIF} {$ENDIF}
inc(Hub.FinishedInterfaceCount);
FFinishedInterfaceIndex:=Hub.FinishedInterfaceCount;
NotifyPendingUsedInterfaces; NotifyPendingUsedInterfaces;
if Section=nil then ; if Section=nil then ;
end; end;
@ -24957,6 +24969,20 @@ begin
exit(true); exit(true);
end; end;
function TPasResolver.GetResolver(El: TPasElement): TPasResolver;
var
Module: TPasModule;
Scope: TPasModuleScope;
begin
Result:=nil;
if El=nil then exit;
Module:=El.GetModule;
if Module=nil then exit;
Scope:=Module.CustomData as TPasModuleScope;
if Scope=nil then exit;
Result:=Scope.Owner as TPasResolver;
end;
function TPasResolver.ElHasModeSwitch(El: TPasElement; ms: TModeSwitch function TPasResolver.ElHasModeSwitch(El: TPasElement; ms: TModeSwitch
): boolean; ): boolean;
begin begin