mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-11 22:08:54 +00:00
@@ -190,7 +190,7 @@ proc getName(node: NimNode): string {.compileTime.} =
|
||||
case node.kind
|
||||
of nnkPostfix:
|
||||
return node[1].strVal
|
||||
of nnkIdent:
|
||||
of nnkIdent, nnkSym:
|
||||
return node.strVal
|
||||
of nnkEmpty:
|
||||
return "anonymous"
|
||||
|
||||
14
tests/async/t9201.nim
Normal file
14
tests/async/t9201.nim
Normal file
@@ -0,0 +1,14 @@
|
||||
discard """
|
||||
exitcode: 0
|
||||
"""
|
||||
|
||||
# Derived from issue #9201
|
||||
import asyncdispatch, macros
|
||||
|
||||
macro newAsyncProc(name: untyped): untyped =
|
||||
expectKind name, nnkStrLit
|
||||
let pName = genSym(nskProc, name.strVal)
|
||||
result = getAst async quote do:
|
||||
proc `pName`() = discard
|
||||
|
||||
newAsyncProc("hello")
|
||||
Reference in New Issue
Block a user