Browse Source

pastojs: fixed creating enum shortrefs for precompiled code

git-svn-id: trunk@48924 -
Mattias Gaertner 4 years ago
parent
commit
f7b819526c
2 changed files with 10 additions and 11 deletions
  1. 8 8
      packages/pastojs/src/fppas2js.pp
  2. 2 3
      packages/pastojs/src/pas2jsfiler.pp

+ 8 - 8
packages/pastojs/src/fppas2js.pp

@@ -8183,7 +8183,7 @@ Var
   HasImplUsesClause, ok, NeedRTLCheckVersion: Boolean;
   Prg: TPasProgram;
   Lib: TPasLibrary;
-  AssignSt: TJSSimpleAssignStatement;
+  ImplFuncAssignSt: TJSSimpleAssignStatement;
   IntfSecCtx: TInterfaceSectionContext;
   ModScope: TPas2JSModuleScope;
 begin
@@ -8290,10 +8290,10 @@ begin
 
       ImplFunc:=CreateImplementationSection(El,IntfSecCtx);
       // add $mod.$implcode = ImplFunc;
-      AssignSt:=TJSSimpleAssignStatement(CreateElement(TJSSimpleAssignStatement,El));
-      AssignSt.LHS:=CreateMemberExpression([ModVarName,GetBIName(pbivnImplCode)]);
-      AssignSt.Expr:=ImplFunc;
-      AddToSourceElements(Src,AssignSt);
+      ImplFuncAssignSt:=TJSSimpleAssignStatement(CreateElement(TJSSimpleAssignStatement,El));
+      ImplFuncAssignSt.LHS:=CreateMemberExpression([ModVarName,GetBIName(pbivnImplCode)]);
+      ImplFuncAssignSt.Expr:=ImplFunc;
+      AddToSourceElements(Src,ImplFuncAssignSt);
 
       // append initialization section
       CreateInitSection(El,Src,IntfSecCtx);
@@ -8305,7 +8305,7 @@ begin
         // remove unneeded $impl from interface
         RemoveFromSourceElements(Src,ImplVarSt);
         // remove unneeded $mod.$implcode = function(){}
-        RemoveFromSourceElements(Src,AssignSt);
+        RemoveFromSourceElements(Src,ImplFuncAssignSt);
         HasImplUsesClause:=(El.ImplementationSection<>nil)
                        and (length(El.ImplementationSection.UsesClause)>0);
         end
@@ -27078,8 +27078,8 @@ begin
   for i:=0 to ElRefList.Count-1 do
     begin
     El:=TPasElement(ElRefList[i]);
-    if ElNeedsGlobalAlias(El) then
-      CreateGlobalElPath(El,SectionContext);
+    // Note: they are all needed by precompiled code, do not check ElNeedsGlobalAlias
+    CreateGlobalElPath(El,SectionContext);
     end;
 end;
 

+ 2 - 3
packages/pastojs/src/pas2jsfiler.pp

@@ -46,8 +46,6 @@ Works:
 - gzipped json
 - write final switches
 - srcmaps for precompiled js
-
-ToDo:
 - generics:
   - generic proc bodies are stored with all elements, but without resolver customdata
   - specializations are stored like external elements
@@ -70,8 +68,9 @@ ToDo:
   - TPCUReader.ReadExternalSpecialized
     -
   - TPCUReader.ReadSpecializeType reads a TPasSpecializeType and creates specialized type
-  - TPCUReader.ReadInlineSpecializeExpr: ToDo create specialized type
+  - TPCUReader.ReadInlineSpecializeExpr: create specialized type
 
+Todo:
 - store used GUIDs
 - distinguish reader errors in fatal and error
 - when pcu is bad, unload and use src