summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authormattias <mattias@3ad0048d-3df7-0310-abae-a5850022a9f2>2020-05-30 11:48:08 +0000
committermattias <mattias@3ad0048d-3df7-0310-abae-a5850022a9f2>2020-05-30 11:48:08 +0000
commitb5eede6a8f26af17036fedd2e6ab7a80c01fe868 (patch)
tree95e0909411c55332b7df8e6f6c638d4559f0e8e0 /packages
parent9d64d28e8285f2b6cac1c3a322f854bf2947db5c (diff)
downloadfpc-b5eede6a8f26af17036fedd2e6ab7a80c01fe868.tar.gz
pas2js: filer: started delay specialize
git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@45530 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'packages')
-rw-r--r--packages/pastojs/src/pas2jsfiler.pp24
1 files changed, 16 insertions, 8 deletions
diff --git a/packages/pastojs/src/pas2jsfiler.pp b/packages/pastojs/src/pas2jsfiler.pp
index ab35a61c9a..a1242c7875 100644
--- a/packages/pastojs/src/pas2jsfiler.pp
+++ b/packages/pastojs/src/pas2jsfiler.pp
@@ -954,6 +954,7 @@ type
public
Spec: TPCUReaderPendingSpecialized;
Index: integer; // index in Spec.Params
+ Id: integer;
Element: TPasElement;
end;
@@ -1035,6 +1036,7 @@ type
AddRef: TPCUAddRef; ErrorEl: TPasElement); virtual;
procedure PromiseSetElArrReference(Id: integer; Arr: TPasElementArray; Index: integer;
AddRef: TPCUAddRef; ErrorEl: TPasElement); virtual;
+ procedure PromiseSpecialize(SpecId: integer; El: TPasElement; const SpecName: string); virtual;
procedure ResolvePending; virtual;
procedure ReadBuiltInSymbols(Obj: TJSONObject; ErrorEl: TPasElement); virtual;
// module
@@ -5793,6 +5795,13 @@ begin
end;
end;
+procedure TPCUReader.PromiseSpecialize(SpecId: integer; El: TPasElement;
+ const SpecName: string);
+begin
+ // ToDo: add to list, specialize when unit interface/impl has finished, resolve nested references
+ RaiseMsg(20200530134408,El,IntToStr(SpecId)+'='+SpecName);
+end;
+
procedure TPCUReader.ResolvePending;
var
i: Integer;
@@ -6410,7 +6419,8 @@ begin
if Id<=0 then
RaiseMsg(20200222191724,ErrorEl,IntToStr(i));
PendParam:=TPCUReaderPendingSpecializedParam(PendSpec.Params[i]);
- PromiseSetElReference(Id,@Set_SpecializeParam,PendParam,ErrorEl);
+ PendParam.Id:=Id;
+ //PromiseSetElReference(Id,@Set_SpecializeParam,PendParam,ErrorEl);
end;
end;
@@ -7931,7 +7941,6 @@ procedure TPCUReader.ReadSpecializeType(Obj: TJSONObject;
var
GenType: TPasGenericType;
GenericTemplateTypes: TFPList;
- SpecType: TPasElement;
ExpName: string;
i, SpecId: Integer;
Data: TPasSpecializeTypeData;
@@ -7963,14 +7972,13 @@ begin
RaiseMsg(20200514130230,El,'SpecType');
PromiseSetElReference(SpecId,@Set_SpecializeTypeData,Data,El);
- // check old specialized name is the same
+ // check old specialized name
if not ReadString(Obj,'SpecName',ExpName,El) then
RaiseMsg(20200219122919,El);
- SpecType:=Data.SpecializedType;
- if SpecType=nil then
- RaiseMsg(20200514131226,El);
- if ExpName<>SpecType.Name then
- RaiseMsg(20200219123003,El,'Expected="'+ExpName+'", but found "'+SpecType.Name+'"');
+ if ExpName='' then
+ RaiseMsg(20200530134152,El);
+
+ PromiseSpecialize(SpecId,El,ExpName);
end;
procedure TPCUReader.ReadInlineSpecializeExpr(Obj: TJSONObject;