|
@@ -1000,6 +1000,7 @@ type
|
|
FElementRefsArray: TPCUFilerElementRefArray; // TPCUFilerElementRef by Id
|
|
FElementRefsArray: TPCUFilerElementRefArray; // TPCUFilerElementRef by Id
|
|
FJSON: TJSONObject;
|
|
FJSON: TJSONObject;
|
|
FPendingIdentifierScopes: TObjectList; // list of TPCUReaderPendingIdentifierScope
|
|
FPendingIdentifierScopes: TObjectList; // list of TPCUReaderPendingIdentifierScope
|
|
|
|
+ FPendingForwardProcs: TFPList; // list of TPasElement waiting for implementation of methods
|
|
FIntfSectionObj: TJSONObject;
|
|
FIntfSectionObj: TJSONObject;
|
|
procedure Set_Variable_VarType(RefEl: TPasElement; Data: TObject);
|
|
procedure Set_Variable_VarType(RefEl: TPasElement; Data: TObject);
|
|
procedure Set_AliasType_DestType(RefEl: TPasElement; Data: TObject);
|
|
procedure Set_AliasType_DestType(RefEl: TPasElement; Data: TObject);
|
|
@@ -6106,6 +6107,7 @@ var
|
|
BuiltInProc: TResElDataBuiltInProc;
|
|
BuiltInProc: TResElDataBuiltInProc;
|
|
bp: TResolverBuiltInProc;
|
|
bp: TResolverBuiltInProc;
|
|
pbt: TPas2jsBaseType;
|
|
pbt: TPas2jsBaseType;
|
|
|
|
+ pbp: TPas2jsBuiltInProc;
|
|
begin
|
|
begin
|
|
if not ReadArray(Obj,BuiltInNodeName,Arr,ErrorEl) then exit;
|
|
if not ReadArray(Obj,BuiltInNodeName,Arr,ErrorEl) then exit;
|
|
for i:=0 to Arr.Count-1 do
|
|
for i:=0 to Arr.Count-1 do
|
|
@@ -6164,6 +6166,21 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
+ if not Found then
|
|
|
|
+ begin
|
|
|
|
+ for pbp in TPas2jsBuiltInProc do
|
|
|
|
+ begin
|
|
|
|
+ BuiltInProc:=Resolver.JSBuiltInProcs[pbp];
|
|
|
|
+ if BuiltInProc=nil then continue;
|
|
|
|
+ El:=BuiltInProc.Element;
|
|
|
|
+ if (CompareText(El.Name,aName)=0) then
|
|
|
|
+ begin
|
|
|
|
+ Found:=true;
|
|
|
|
+ AddElReference(Id,ErrorEl,El);
|
|
|
|
+ break;
|
|
|
|
+ end;
|
|
|
|
+ end;
|
|
|
|
+ end;
|
|
if not Found then
|
|
if not Found then
|
|
RaiseMsg(20180216231551,ErrorEl,aName);
|
|
RaiseMsg(20180216231551,ErrorEl,aName);
|
|
end;
|
|
end;
|
|
@@ -6931,6 +6948,8 @@ procedure TPCUReader.ReadSection(Obj: TJSONObject; Section: TPasSection;
|
|
// Note: can be called twice for each section if there are pending used interfaces
|
|
// Note: can be called twice for each section if there are pending used interfaces
|
|
var
|
|
var
|
|
Scope: TPas2JSSectionScope;
|
|
Scope: TPas2JSSectionScope;
|
|
|
|
+ i: Integer;
|
|
|
|
+ El: TPasElement;
|
|
begin
|
|
begin
|
|
{$IFDEF VerbosePCUFiler}
|
|
{$IFDEF VerbosePCUFiler}
|
|
writeln('TPCUReader.ReadSection ',GetObjName(Section));
|
|
writeln('TPCUReader.ReadSection ',GetObjName(Section));
|
|
@@ -6965,10 +6984,19 @@ begin
|
|
end;
|
|
end;
|
|
|
|
|
|
Scope.Finished:=true;
|
|
Scope.Finished:=true;
|
|
- if Section is TInterfaceSection then
|
|
|
|
|
|
+ if Section.ClassType=TInterfaceSection then
|
|
begin
|
|
begin
|
|
ResolvePending(false);
|
|
ResolvePending(false);
|
|
Resolver.NotifyPendingUsedInterfaces;
|
|
Resolver.NotifyPendingUsedInterfaces;
|
|
|
|
+ end
|
|
|
|
+ else if Section.ClassType=TImplementationSection then
|
|
|
|
+ begin
|
|
|
|
+ for i:=0 to FPendingForwardProcs.Count-1 do
|
|
|
|
+ begin
|
|
|
|
+ El:=TPasElement(FPendingForwardProcs[i]);
|
|
|
|
+ Resolver.CheckPendingForwardProcs(El);
|
|
|
|
+ end;
|
|
|
|
+ FPendingForwardProcs.Clear;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -8543,7 +8571,7 @@ begin
|
|
Resolver.PopScope;
|
|
Resolver.PopScope;
|
|
end;
|
|
end;
|
|
ReadRecordScope(Obj,Scope,aContext);
|
|
ReadRecordScope(Obj,Scope,aContext);
|
|
- Resolver.FinishSpecializedClassOrRecIntf(Scope);
|
|
|
|
|
|
+ Resolver.FinishGenericClassOrRecIntf(Scope);
|
|
Resolver.FinishSpecializations(Scope);
|
|
Resolver.FinishSpecializations(Scope);
|
|
|
|
|
|
ReadSpecializations(Obj,El);
|
|
ReadSpecializations(Obj,El);
|
|
@@ -8914,8 +8942,9 @@ begin
|
|
finally
|
|
finally
|
|
Resolver.PopScope;
|
|
Resolver.PopScope;
|
|
end;
|
|
end;
|
|
- Resolver.FinishSpecializedClassOrRecIntf(Scope);
|
|
|
|
- Resolver.FinishSpecializations(Scope);
|
|
|
|
|
|
+ Resolver.FinishGenericClassOrRecIntf(Scope);
|
|
|
|
+ if (El.GenericTemplateTypes<>nil) and (El.GenericTemplateTypes.Count>0) then
|
|
|
|
+ FPendingForwardProcs.Add(El);
|
|
ReadSpecializations(Obj,El);
|
|
ReadSpecializations(Obj,El);
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
@@ -9446,7 +9475,7 @@ var
|
|
DefProcMods: TProcedureModifiers;
|
|
DefProcMods: TProcedureModifiers;
|
|
t: TProcedureMessageType;
|
|
t: TProcedureMessageType;
|
|
s: string;
|
|
s: string;
|
|
- Found: Boolean;
|
|
|
|
|
|
+ Found, HasBody: Boolean;
|
|
Scope: TPas2JSProcedureScope;
|
|
Scope: TPas2JSProcedureScope;
|
|
DeclProcId: integer;
|
|
DeclProcId: integer;
|
|
Ref: TPCUFilerElementRef;
|
|
Ref: TPCUFilerElementRef;
|
|
@@ -9470,6 +9499,7 @@ begin
|
|
|
|
|
|
ReadPasElement(Obj,El,aContext);
|
|
ReadPasElement(Obj,El,aContext);
|
|
|
|
|
|
|
|
+ HasBody:=Obj.Find('Body')<>nil;
|
|
if ReadInteger(Obj,'DeclarationProc',DeclProcId,El) then
|
|
if ReadInteger(Obj,'DeclarationProc',DeclProcId,El) then
|
|
begin
|
|
begin
|
|
// ImplProc
|
|
// ImplProc
|
|
@@ -9481,8 +9511,19 @@ begin
|
|
DeclProc:=TPasProcedure(Ref.Element);
|
|
DeclProc:=TPasProcedure(Ref.Element);
|
|
Scope.DeclarationProc:=DeclProc; // no AddRef
|
|
Scope.DeclarationProc:=DeclProc; // no AddRef
|
|
|
|
|
|
- El.ProcType:=TPasProcedureType(CreateElement(TPasProcedureTypeClass(DeclProc.ProcType.ClassType),'',DeclProc));
|
|
|
|
|
|
+ El.ProcType:=TPasProcedureType(CreateElement(TPasProcedureTypeClass(DeclProc.ProcType.ClassType),'',El));
|
|
El.Modifiers:=ReadProcedureModifiers(Obj,El,'PMods',DeclProc.Modifiers*PCUProcedureModifiersImplProc);
|
|
El.Modifiers:=ReadProcedureModifiers(Obj,El,'PMods',DeclProc.Modifiers*PCUProcedureModifiersImplProc);
|
|
|
|
+
|
|
|
|
+ if HasBody then
|
|
|
|
+ begin
|
|
|
|
+ // not a precompiled proc -> copy signature
|
|
|
|
+ //if El.ProcType is TPasFunctionType then
|
|
|
|
+ // begin
|
|
|
|
+ // FuncType:=TPasFunctionType(El.ProcType);
|
|
|
|
+ // FuncType.ResultEl:=TPasResultElement(CreateElement(TPasResultElement,
|
|
|
|
+ // TPasFunctionType(DeclProc.ProcType).ResultEl.Name,FuncType));
|
|
|
|
+ // end;
|
|
|
|
+ end;
|
|
end
|
|
end
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
@@ -9526,7 +9567,7 @@ begin
|
|
if (Scope<>nil) and (Obj.Find('ImplProc')=nil) then
|
|
if (Scope<>nil) and (Obj.Find('ImplProc')=nil) then
|
|
ReadProcScopeReferences(Obj,Scope);
|
|
ReadProcScopeReferences(Obj,Scope);
|
|
|
|
|
|
- if Obj.Find('Body')<>nil then
|
|
|
|
|
|
+ if HasBody then
|
|
ReadProcedureBody(Obj,El,aContext);
|
|
ReadProcedureBody(Obj,El,aContext);
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -9813,12 +9854,14 @@ begin
|
|
inherited Create;
|
|
inherited Create;
|
|
FInitialFlags:=TPCUInitialFlags.Create;
|
|
FInitialFlags:=TPCUInitialFlags.Create;
|
|
FPendingIdentifierScopes:=TObjectList.Create(true);
|
|
FPendingIdentifierScopes:=TObjectList.Create(true);
|
|
|
|
+ FPendingForwardProcs:=TFPList.Create;
|
|
end;
|
|
end;
|
|
|
|
|
|
destructor TPCUReader.Destroy;
|
|
destructor TPCUReader.Destroy;
|
|
begin
|
|
begin
|
|
FreeAndNil(FJSON);
|
|
FreeAndNil(FJSON);
|
|
inherited Destroy;
|
|
inherited Destroy;
|
|
|
|
+ FreeAndNil(FPendingForwardProcs);
|
|
FreeAndNil(FPendingIdentifierScopes);
|
|
FreeAndNil(FPendingIdentifierScopes);
|
|
FreeAndNil(FInitialFlags);
|
|
FreeAndNil(FInitialFlags);
|
|
end;
|
|
end;
|
|
@@ -9834,6 +9877,7 @@ begin
|
|
FPendingIdentifierScopes.Clear;
|
|
FPendingIdentifierScopes.Clear;
|
|
while FPendingSpecialize<>nil do
|
|
while FPendingSpecialize<>nil do
|
|
DeletePendingSpecialize(FPendingSpecialize);
|
|
DeletePendingSpecialize(FPendingSpecialize);
|
|
|
|
+ FPendingForwardProcs.Clear;
|
|
|
|
|
|
inherited Clear;
|
|
inherited Clear;
|
|
FInitialFlags.Clear;
|
|
FInitialFlags.Clear;
|