summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rw-r--r--compiler/cgendata.nim2
-rw-r--r--compiler/jsgen.nim4
2 files changed, 6 insertions, 0 deletions
diff --git a/compiler/cgendata.nim b/compiler/cgendata.nim
index 4d15cf131..9cc146c4d 100644
--- a/compiler/cgendata.nim
+++ b/compiler/cgendata.nim
@@ -196,6 +196,8 @@ proc newProc*(prc: PSym, module: BModule): BProc =
   result = BProc(
     prc: prc,
     module: module,
+    optionsStack: if module.initProc != nil: module.initProc.optionsStack
+                  else: @[],
     options: if prc != nil: prc.options
              else: module.config.options,
     blocks: @[initBlock()],
diff --git a/compiler/jsgen.nim b/compiler/jsgen.nim
index 8be4d9d07..a5f4d29b2 100644
--- a/compiler/jsgen.nim
+++ b/compiler/jsgen.nim
@@ -50,6 +50,7 @@ type
     graph: ModuleGraph
     config: ConfigRef
     sigConflicts: CountTable[SigHash]
+    initProc: PProc
 
   BModule = ref TJSGen
   TJSTypeKind = enum       # necessary JS "types"
@@ -158,6 +159,8 @@ proc newProc(globals: PGlobals, module: BModule, procDef: PNode,
              options: TOptions): PProc =
   result = PProc(
     blocks: @[],
+    optionsStack: if module.initProc != nil: module.initProc.optionsStack
+                  else: @[],
     options: options,
     module: module,
     procDef: procDef,
@@ -3036,6 +3039,7 @@ proc processJSCodeGen*(b: PPassContext, n: PNode): PNode =
   if m.module == nil: internalError(m.config, n.info, "myProcess")
   let globals = PGlobals(m.graph.backend)
   var p = newInitProc(globals, m)
+  m.initProc = p
   p.unique = globals.unique
   genModule(p, n)
   p.g.code.add(p.locals)