Handle multiple childs for opensymchoice (#266)
And more tests. Follow up of #261
This commit is contained in:
parent
5a906ad56c
commit
ae19d5b6f0
|
@ -77,10 +77,9 @@ proc cleanupOpenSymChoice(node: NimNode): NimNode {.compileTime.} =
|
|||
# ref https://github.com/nim-lang/Nim/issues/11091
|
||||
if node.kind in nnkCallKinds and
|
||||
node[0].kind == nnkOpenSymChoice and node[0].eqIdent("[]"):
|
||||
result = newNimNode(nnkBracketExpr).add(
|
||||
cleanupOpenSymChoice(node[1]),
|
||||
cleanupOpenSymChoice(node[2])
|
||||
)
|
||||
result = newNimNode(nnkBracketExpr)
|
||||
for child in node[1..^1]:
|
||||
result.add(cleanupOpenSymChoice(child))
|
||||
else:
|
||||
result = node.copyNimNode()
|
||||
for child in node:
|
||||
|
|
|
@ -97,3 +97,10 @@ suite "Macro transformations test suite":
|
|||
type OpenObject = object
|
||||
macroAsync(testMacro, seq, OpenObject)
|
||||
check waitFor(testMacro()).len == 0
|
||||
|
||||
macro macroAsync2(name, restype, inner1, inner2, inner3, inner4: untyped): untyped =
|
||||
quote do:
|
||||
proc `name`(): Future[`restype`[`inner1`[`inner2`[`inner3`, `inner4`]]]] {.async.} = return
|
||||
|
||||
macroAsync2(testMacro2, seq, Opt, Result, OpenObject, cstring)
|
||||
check waitFor(testMacro2()).len == 0
|
||||
|
|
Loading…
Reference in New Issue