diff options
author | Timothee Cour <timothee.cour2@gmail.com> | 2021-04-23 05:36:38 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-23 14:36:38 +0200 |
commit | 2abc936d511342265d2ef27c4b079dd49332d65a (patch) | |
tree | 9c6b945447a8a2b31c9c752e92f8984cb630f3ae /lib | |
parent | 3516f57e172cef22f583f43c7b16fd1f63921c6e (diff) | |
download | Nim-2abc936d511342265d2ef27c4b079dd49332d65a.tar.gz |
`typeof(voidStmt)` now works (#17807)
* `typeof(voidStmt)` now works * remove typeOrVoid * add condsyms, and reference cligen https://github.com/c-blake/cligen/pull/193 * fixup * changelog [skip ci] * fixup
Diffstat (limited to 'lib')
-rw-r--r-- | lib/js/asyncjs.nim | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/js/asyncjs.nim b/lib/js/asyncjs.nim index c62ac633f..861fe3fe2 100644 --- a/lib/js/asyncjs.nim +++ b/lib/js/asyncjs.nim @@ -158,10 +158,6 @@ proc newPromise*(handler: proc(resolve: proc())): Future[void] {.importjs: "(new ## A helper for wrapping callback-based functions ## into promises and async procedures. -template typeOrVoid[T](a: T): type = - # xxx this is useful, make it public in std/typetraits in future work - T - template maybeFuture(T): untyped = # avoids `Future[Future[T]]` when T is Future: T @@ -221,7 +217,8 @@ when defined(nimExperimentalAsyncjsThen): assert witness == 3 template impl(call): untyped = - when typeOrVoid(call) is void: + # see D20210421T014713 + when typeof(block: call) is void: var ret: Future[void] else: var ret = default(maybeFuture(typeof(call))) |