pastojs: fixed creating enum shortrefs for precompiled code

git-svn-id: trunk@48924 -
(cherry picked from commit f7b819526c)
This commit is contained in:
Mattias Gaertner 2021-03-08 20:29:55 +00:00 committed by Florian Klämpfl
parent a487401c7b
commit 9da119038e
2 changed files with 10 additions and 11 deletions

View File

@ -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;

View File

@ -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