summary refs log tree commit diff stats
path: root/compiler/pragmas.nim
diff options
context:
space:
mode:
authorcooldome <cdome@bk.ru>2019-11-07 13:47:26 +0000
committerAndreas Rumpf <rumpf_a@web.de>2019-11-07 14:47:26 +0100
commite1b1759439afed3d5af1207044f81d706af8b522 (patch)
tree779cb946ee400befc42742e32e366dd7c7f65020 /compiler/pragmas.nim
parent94675c2378aed37a76899b4ab9cae9962e3d9542 (diff)
downloadNim-e1b1759439afed3d5af1207044f81d706af8b522.tar.gz
fixes #5050; fixes #11826 (#12606) [backport]
Diffstat (limited to 'compiler/pragmas.nim')
-rw-r--r--compiler/pragmas.nim14
1 files changed, 2 insertions, 12 deletions
diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim
index 8639f8e7b..b1eecc50e 100644
--- a/compiler/pragmas.nim
+++ b/compiler/pragmas.nim
@@ -418,14 +418,7 @@ proc processOption(c: PContext, n: PNode, resOptions: var TOptions) =
 proc processPush(c: PContext, n: PNode, start: int) =
   if n.sons[start-1].kind in nkPragmaCallKinds:
     localError(c.config, n.info, "'push' cannot have arguments")
-  var x = newOptionEntry(c.config)
-  var y = c.optionStack[^1]
-  x.options = c.config.options
-  x.defaultCC = y.defaultCC
-  x.dynlib = y.dynlib
-  x.notes = c.config.notes
-  x.features = c.features
-  c.optionStack.add(x)
+  var x = pushOptionEntry(c)
   for i in start ..< len(n):
     if not tryProcessOption(c, n.sons[i], c.config.options):
       # simply store it somewhere:
@@ -444,10 +437,7 @@ proc processPop(c: PContext, n: PNode) =
   if c.optionStack.len <= 1:
     localError(c.config, n.info, "{.pop.} without a corresponding {.push.}")
   else:
-    c.config.options = c.optionStack[^1].options
-    c.config.notes = c.optionStack[^1].notes
-    c.features = c.optionStack[^1].features
-    c.optionStack.setLen(c.optionStack.len - 1)
+    popOptionEntry(c)
   when defined(debugOptions):
     echo c.config $ n.info, " POP config is now ", c.config.options