diff options
Diffstat (limited to 'lib/pure/asyncmacro.nim')
-rw-r--r-- | lib/pure/asyncmacro.nim | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/pure/asyncmacro.nim b/lib/pure/asyncmacro.nim index d80a47101..e41568b8c 100644 --- a/lib/pure/asyncmacro.nim +++ b/lib/pure/asyncmacro.nim @@ -221,13 +221,11 @@ proc asyncSingleProc(prc: NimNode): NimNode = procBody = newStmtList() let resultIdent = ident"result" procBody.add quote do: - template nimAsyncDispatchSetResult(x: `subRetType`) {.used.} = - # If the proc has implicit return then this will get called - `resultIdent` = x - template nimAsyncDispatchSetResult(x: untyped) {.used.} = - # If the proc doesn't have implicit return then this will get called - x - procBody.add newCall(ident"nimAsyncDispatchSetResult", blockStmt) + # Check whether there is an implicit return + when typeof(`blockStmt`) is void: + `blockStmt` + else: + `resultIdent` = `blockStmt` procBody.add(createFutureVarCompletions(futureVarIdents, nil)) procBody.insert(0): quote do: {.push warning[resultshadowed]: off.} |