fixes #798
This commit is contained in:
parent
5d6053173a
commit
7c065bfadf
12 changed files with 10 additions and 2 deletions
|
|
@ -68,7 +68,8 @@ proc hlo(c: PContext, n: PNode): PNode =
|
||||||
result = n
|
result = n
|
||||||
else:
|
else:
|
||||||
if n.kind in {nkFastAsgn, nkAsgn, nkIdentDefs, nkVarTuple} and
|
if n.kind in {nkFastAsgn, nkAsgn, nkIdentDefs, nkVarTuple} and
|
||||||
n.sons[0].kind == nkSym and sfGlobal in n.sons[0].sym.flags:
|
n.sons[0].kind == nkSym and
|
||||||
|
{sfGlobal, sfPure} * n.sons[0].sym.flags == {sfGlobal, sfPure}:
|
||||||
# do not optimize 'var g {.global} = re(...)' again!
|
# do not optimize 'var g {.global} = re(...)' again!
|
||||||
return n
|
return n
|
||||||
result = applyPatterns(c, n)
|
result = applyPatterns(c, n)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
discard """
|
discard """
|
||||||
output: '''3060
|
output: '''3060
|
||||||
true'''
|
true
|
||||||
|
3'''
|
||||||
"""
|
"""
|
||||||
|
|
||||||
template arithOps: expr = (`+` | `-` | `*`)
|
template arithOps: expr = (`+` | `-` | `*`)
|
||||||
|
|
@ -19,3 +20,9 @@ var
|
||||||
c = false
|
c = false
|
||||||
a = b and a
|
a = b and a
|
||||||
echo a
|
echo a
|
||||||
|
|
||||||
|
# bug #798
|
||||||
|
template t012{(0|1|2){x}}(x: expr): expr = x+1
|
||||||
|
let z = 1
|
||||||
|
# outputs 3 thanks to fixpoint iteration:
|
||||||
|
echo z
|
||||||
Loading…
Add table
Add a link
Reference in a new issue