summary refs log tree commit diff stats
path: root/lib/pure
diff options
context:
space:
mode:
authorLemonBoy <LemonBoy@users.noreply.github.com>2019-01-22 09:41:11 +0100
committerAndreas Rumpf <rumpf_a@web.de>2019-01-22 09:41:11 +0100
commit792dbed57e2f4475cab8dcc72114ea5f844113c9 (patch)
tree2831ab896d26314b373d055c6ac802525ffe50e8 /lib/pure
parent226c15499fe829d533b4811aa5c68b15de870b04 (diff)
downloadNim-792dbed57e2f4475cab8dcc72114ea5f844113c9.tar.gz
Restore the docstring during the .async. transform (#10404) [backport]
Fixes #9816
Diffstat (limited to 'lib/pure')
-rw-r--r--lib/pure/asyncmacro.nim6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/pure/asyncmacro.nim b/lib/pure/asyncmacro.nim
index b18d20d55..f1e0aa568 100644
--- a/lib/pure/asyncmacro.nim
+++ b/lib/pure/asyncmacro.nim
@@ -245,6 +245,12 @@ proc asyncSingleProc(prc: NimNode): NimNode {.compileTime.} =
 
   var outerProcBody = newNimNode(nnkStmtList, prc.body)
 
+  # Extract the documentation comment from the original procedure declaration.
+  # Note that we're not removing it from the body in order not to make this
+  # transformation even more complex.
+  if prc.body.len > 1 and prc.body[0].kind == nnkCommentStmt:
+    outerProcBody.add(prc.body[0])
+
   # -> var retFuture = newFuture[T]()
   var retFutureSym = genSym(nskVar, "retFuture")
   var subRetType =