fixes #1319
This commit is contained in:
parent
b89495ef0f
commit
0339b9d386
2 changed files with 29 additions and 1 deletions
|
|
@ -565,6 +565,9 @@ proc transformCall(c: PTransf, n: PNode): PTransNode =
|
||||||
inc(j)
|
inc(j)
|
||||||
add(result, a.PTransNode)
|
add(result, a.PTransNode)
|
||||||
if len(result) == 2: result = result[1]
|
if len(result) == 2: result = result[1]
|
||||||
|
elif getMagic(n) == mNBindSym:
|
||||||
|
# for bindSym(myconst) we MUST NOT perform constant folding:
|
||||||
|
result = n.PTransNode
|
||||||
else:
|
else:
|
||||||
let s = transformSons(c, n).PNode
|
let s = transformSons(c, n).PNode
|
||||||
# bugfix: check after 'transformSons' if it's still a method call:
|
# bugfix: check after 'transformSons' if it's still a method call:
|
||||||
|
|
|
||||||
25
tests/macros/tbindsym.nim
Normal file
25
tests/macros/tbindsym.nim
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
discard """
|
||||||
|
output: '''TFoo
|
||||||
|
TBar'''
|
||||||
|
"""
|
||||||
|
|
||||||
|
# bug #1319
|
||||||
|
|
||||||
|
import macros
|
||||||
|
|
||||||
|
type
|
||||||
|
TTextKind = enum
|
||||||
|
TFoo, TBar
|
||||||
|
|
||||||
|
macro test: stmt =
|
||||||
|
var x = @[TFoo, TBar]
|
||||||
|
result = newStmtList()
|
||||||
|
for i in x:
|
||||||
|
result.add newCall(newIdentNode("echo"),
|
||||||
|
case i
|
||||||
|
of TFoo:
|
||||||
|
bindSym("TFoo")
|
||||||
|
of TBar:
|
||||||
|
bindSym("TBar"))
|
||||||
|
|
||||||
|
test()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue