mirror of
https://gitlab.com/freepascal.org/fpc/pas2js.git
synced 2025-04-13 08:39:23 +02:00
pastojs: filer: fixed checking signature in interface used unit referenced by implementation and needing indirect implementation unit
This commit is contained in:
parent
7e130ffc53
commit
8c2d82b2f9
@ -793,6 +793,7 @@ type
|
||||
procedure WriteIdentifierScope(Obj: TJSONObject; Scope: TPasIdentifierScope; aContext: TPCUWriterContext); virtual;
|
||||
procedure WriteModuleScopeFlags(Obj: TJSONObject; const Value, DefaultValue: TPasModuleScopeFlags); virtual;
|
||||
procedure WriteModuleScope(Obj: TJSONObject; Scope: TPas2JSModuleScope; aContext: TPCUWriterContext); virtual;
|
||||
procedure WriteModuleScopeLocalVars(Obj: TJSONObject; Scope: TPas2JSModuleScope); virtual;
|
||||
// element utilities
|
||||
procedure WriteSrcPos(Obj: TJSONObject; El: TPasElement; aContext: TPCUWriterContext); virtual;
|
||||
procedure WritePasElement(Obj: TJSONObject; El: TPasElement; aContext: TPCUWriterContext); virtual;
|
||||
@ -999,7 +1000,6 @@ type
|
||||
FElementRefsArray: TPCUFilerElementRefArray; // TPCUFilerElementRef by Id
|
||||
FJSON: TJSONObject;
|
||||
FPendingIdentifierScopes: TObjectList; // list of TPCUReaderPendingIdentifierScope
|
||||
FIntfSectionObj: TJSONObject;
|
||||
procedure Set_Variable_VarType(RefEl: TPasElement; Data: TObject);
|
||||
procedure Set_AliasType_DestType(RefEl: TPasElement; Data: TObject);
|
||||
procedure Set_PointerType_DestType(RefEl: TPasElement; Data: TObject);
|
||||
@ -2681,6 +2681,8 @@ begin
|
||||
WImplBlock(aModule.FinalizationSection,'Final');
|
||||
end;
|
||||
|
||||
WriteModuleScopeLocalVars(Obj,ModScope);
|
||||
|
||||
//writeln('TPCUWriter.WriteModule WriteExternalReferences of implementation ',Resolver.RootElement.Name,' aContext.Section=',GetObjName(aContext.Section));
|
||||
WriteExternalReferences(aContext);
|
||||
|
||||
@ -2793,10 +2795,6 @@ procedure TPCUWriter.WriteModuleScope(Obj: TJSONObject;
|
||||
Scope: TPas2JSModuleScope; aContext: TPCUWriterContext);
|
||||
var
|
||||
aModule: TPasModule;
|
||||
i: Integer;
|
||||
SubObj: TJSONObject;
|
||||
LocalVar: TPas2JSStoredLocalVar;
|
||||
LocalVars: TPas2JSStoredLocalVarArray;
|
||||
begin
|
||||
aModule:=Scope.Element as TPasModule;
|
||||
if Scope.FirstName<>FirstDottedIdentifier(aModule.Name) then
|
||||
@ -2812,6 +2810,19 @@ begin
|
||||
AddReferenceToObj(Obj,'SystemTVarRec',Scope.SystemTVarRec);
|
||||
AddReferenceToObj(Obj,'SystemVarRecs',Scope.SystemVarRecs);
|
||||
|
||||
// Scope.StoreJSLocalVars is written later, because some references need implementation units
|
||||
|
||||
WritePasScope(Obj,Scope,aContext);
|
||||
end;
|
||||
|
||||
procedure TPCUWriter.WriteModuleScopeLocalVars(Obj: TJSONObject;
|
||||
Scope: TPas2JSModuleScope);
|
||||
var
|
||||
LocalVars: TPas2JSStoredLocalVarArray;
|
||||
SubObj: TJSONObject;
|
||||
i: Integer;
|
||||
LocalVar: TPas2JSStoredLocalVar;
|
||||
begin
|
||||
// StoreJSLocalVars
|
||||
LocalVars:=Scope.StoreJSLocalVars;
|
||||
if length(LocalVars)>0 then
|
||||
@ -2828,8 +2839,6 @@ begin
|
||||
AddReferenceToObj(SubObj,LocalVar.Name,LocalVar.Element);
|
||||
end;
|
||||
end;
|
||||
|
||||
WritePasScope(Obj,Scope,aContext);
|
||||
end;
|
||||
|
||||
procedure TPCUWriter.WriteSrcPos(Obj: TJSONObject; El: TPasElement;
|
||||
@ -3474,7 +3483,7 @@ begin
|
||||
begin
|
||||
// indirectly used unit (refs to directly used units are created in WriteSection)
|
||||
if aContext.IndirectUsesArr=nil then
|
||||
begin
|
||||
begin
|
||||
if aContext.SectionObj=nil then
|
||||
RaiseMsg(20180314154428,El);
|
||||
//writeln('TPCUWriter.WriteExternalReference ',Resolver.RootElement.Name,' Section=',GetObjName(aContext.Section),' IndirectUses=',El.Name);
|
||||
@ -6982,7 +6991,7 @@ begin
|
||||
RaiseMsg(20180313134142,Section,GetObjName(Section.PendingUsedIntf));
|
||||
if Arr.Count<>length(Section.UsesClause) then
|
||||
RaiseMsg(20180313134338,IntToStr(Arr.Count)+'<>'+IntToStr(length(Section.UsesClause)));
|
||||
for i:=0 to Arr.Count-1 do
|
||||
for i:=0 to Arr.Count-1 do
|
||||
begin
|
||||
Data:=Arr[i];
|
||||
if not (Data is TJSONObject) then
|
||||
@ -6999,15 +7008,7 @@ begin
|
||||
end;
|
||||
|
||||
// read external refs from indirectly used units
|
||||
if Section.ClassType=TInterfaceSection then
|
||||
FIntfSectionObj:=Obj
|
||||
else if Section.ClassType=TImplementationSection then
|
||||
begin
|
||||
ReadIndirectUsedUnits(FIntfSectionObj,Section,true);
|
||||
ReadIndirectUsedUnits(Obj,Section,true);
|
||||
end
|
||||
else
|
||||
ReadIndirectUsedUnits(Obj,Section,true);
|
||||
ReadIndirectUsedUnits(Obj,Section,true);
|
||||
|
||||
Scope.UsesFinished:=true;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user