summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorDominik Picheta <dominikpicheta@googlemail.com>2018-03-05 11:12:01 +0000
committerGitHub <noreply@github.com>2018-03-05 11:12:01 +0000
commit363c703e723238fc625e0047bd1baa3af6d47ac9 (patch)
tree876abdf0adf2af0c306943f6e24d34a2622125d9 /tests
parenta568e4dac6b3e338b4ad42c06be25a3d77b375f5 (diff)
parentb6c69dd45e9d06179de64bf47a6aea04521c500b (diff)
downloadNim-363c703e723238fc625e0047bd1baa3af6d47ac9.tar.gz
Merge pull request #7289 from alehander42/fix-asyncjs-pragma
Stop replacing all pragmas of a function with asyncjs
Diffstat (limited to 'tests')
-rw-r--r--tests/js/tasync_pragma.nim27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/js/tasync_pragma.nim b/tests/js/tasync_pragma.nim
new file mode 100644
index 000000000..916769fad
--- /dev/null
+++ b/tests/js/tasync_pragma.nim
@@ -0,0 +1,27 @@
+discard """
+  output: '''
+0
+t
+'''
+"""
+
+import asyncjs, macros
+
+macro f*(a: untyped): untyped =
+  assert a.kind == nnkProcDef
+  result = nnkProcDef.newTree(a.name, a[1], a[2], a.params, a.pragma, a[5], nnkStmtList.newTree())
+  let call = quote:
+    echo 0
+  result.body.add(call)
+  for child in a.body:
+    result.body.add(child)
+  #echo result.body.repr
+
+proc t* {.async, f.} =
+  echo "t"
+
+proc t0* {.async.} =
+  await t()
+
+discard t0()
+