fixes #5050; fixes #11826 (#12606) [backport]

This commit is contained in:
cooldome 2019-11-07 13:47:26 +00:00 • committed by Andreas Rumpf
commit e1b1759439
5 changed files with 47 additions and 14 deletions

View file

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