parent
0036014727
commit
294b2e03b2
2 changed files with 35 additions and 7 deletions
26
tests/macros/t8997.nim
Normal file
26
tests/macros/t8997.nim
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
discard """
|
||||
line: 24
|
||||
errormsg: "illformed AST: "
|
||||
"""
|
||||
|
||||
import macros
|
||||
|
||||
type
|
||||
Node* = ref object
|
||||
children: seq[Node]
|
||||
|
||||
proc newNode*(): Node =
|
||||
Node(children: newSeq[Node]())
|
||||
|
||||
macro build*(body: untyped): untyped =
|
||||
|
||||
template appendElement(tmp, childrenBlock) {.dirty.} =
|
||||
bind newNode
|
||||
let tmp = newNode()
|
||||
tmp.children = childrenBlock # this line seems to be the problem
|
||||
|
||||
let tmp = genSym(nskLet, "tmp")
|
||||
let childrenBlock = newEmptyNode()
|
||||
result = getAst(appendElement(tmp, childrenBlock))
|
||||
|
||||
build(body)
|
||||
Loading…
Add table
Add a link
Reference in a new issue