From 7583ad7e90f541acbcbc1457abd3ab30cf2657aa Mon Sep 17 00:00:00 2001 From: mattias Date: Mon, 8 Mar 2021 20:29:55 +0000 Subject: pastojs: fixed creating enum shortrefs for precompiled code git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@48924 3ad0048d-3df7-0310-abae-a5850022a9f2 --- packages/pastojs/src/fppas2js.pp | 16 ++++++++-------- packages/pastojs/src/pas2jsfiler.pp | 5 ++--- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/packages/pastojs/src/fppas2js.pp b/packages/pastojs/src/fppas2js.pp index a0fd7c6ecf..21498b9f86 100644 --- a/packages/pastojs/src/fppas2js.pp +++ b/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; diff --git a/packages/pastojs/src/pas2jsfiler.pp b/packages/pastojs/src/pas2jsfiler.pp index 4a28a96f78..6e9660b891 100644 --- a/packages/pastojs/src/pas2jsfiler.pp +++ b/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 -- cgit v1.2.1