Browse Source

pastojs: fixed mark impl scope ref of VarRecs

git-svn-id: trunk@41350 -
Mattias Gaertner 6 years ago
parent
commit
3ecfa10417
1 changed files with 8 additions and 3 deletions
  1. 8 3
      packages/pastojs/src/pas2jsuseanalyzer.pp

+ 8 - 3
packages/pastojs/src/pas2jsuseanalyzer.pp

@@ -48,6 +48,8 @@ procedure TPas2JSAnalyzer.UseExpr(El: TPasExpr);
     i: Integer;
     i: Integer;
     ArgType: TPasType;
     ArgType: TPasType;
     ModScope: TPas2JSModuleScope;
     ModScope: TPas2JSModuleScope;
+    aMod: TPasModule;
+    SystemVarRecs: TPasFunction;
   begin
   begin
     if Args=nil then exit;
     if Args=nil then exit;
     for i:=0 to Args.Count-1 do
     for i:=0 to Args.Count-1 do
@@ -58,10 +60,13 @@ procedure TPas2JSAnalyzer.UseExpr(El: TPasExpr);
           and (TPasArrayType(ArgType).ElType=nil) then
           and (TPasArrayType(ArgType).ElType=nil) then
         begin
         begin
         // array of const
         // array of const
-        ModScope:=NoNil(Resolver.RootElement.CustomData) as TPas2JSModuleScope;
-        if ModScope.SystemVarRecs=nil then
+        aMod:=El.GetModule;
+        ModScope:=NoNil(aMod.CustomData) as TPas2JSModuleScope;
+        SystemVarRecs:=ModScope.SystemVarRecs;
+        if SystemVarRecs=nil then
           RaiseNotSupported(20190216104347,El);
           RaiseNotSupported(20190216104347,El);
-        UseProcedure(ModScope.SystemVarRecs);
+        MarkImplScopeRef(El,SystemVarRecs,psraRead);
+        UseProcedure(SystemVarRecs);
         break;
         break;
         end;
         end;
       end;
       end;