This commit is contained in:
Yuriy Glukhov 2017-06-18 00:52:56 +03:00
commit 58eae1171d
3 changed files with 5 additions and 2 deletions

View file

@ -1129,7 +1129,7 @@ proc semProcAnnotation(c: PContext, prc: PNode;
x.add(it.sons[1]) x.add(it.sons[1])
x.add(prc) x.add(prc)
# recursion assures that this works for multiple macro annotations too: # recursion assures that this works for multiple macro annotations too:
result = semStmt(c, x) result = semExpr(c, x)
# since a proc annotation can set pragmas, we process these here again. # since a proc annotation can set pragmas, we process these here again.
# This is required for SqueakNim-like export pragmas. # This is required for SqueakNim-like export pragmas.
if result.kind in procDefs and result[namePos].kind == nkSym and if result.kind in procDefs and result[namePos].kind == nkSym and

View file

@ -301,7 +301,7 @@ proc verifyReturnType(typeName: string) {.compileTime.} =
proc asyncSingleProc(prc: NimNode): NimNode {.compileTime.} = proc asyncSingleProc(prc: NimNode): NimNode {.compileTime.} =
## This macro transforms a single procedure into a closure iterator. ## This macro transforms a single procedure into a closure iterator.
## The ``async`` macro supports a stmtList holding multiple async procedures. ## The ``async`` macro supports a stmtList holding multiple async procedures.
if prc.kind notin {nnkProcDef, nnkLambda, nnkMethodDef}: if prc.kind notin {nnkProcDef, nnkLambda, nnkMethodDef, nnkDo}:
error("Cannot transform this node kind into an async proc." & error("Cannot transform this node kind into an async proc." &
" proc/method definition or lambda node expected.") " proc/method definition or lambda node expected.")

View file

@ -51,5 +51,8 @@ proc main() =
var builder = newBuilder() var builder = newBuilder()
# Test {.async.} pragma with do notation: #5995
builder.client = newClient("builder") do(client: Client, msg: JsonNode) {.async.}:
await onMessage(builder, msg)
main() main()