Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* remove unnecessary when statement

* remove outdated codes

* fix nim-lang#17177

* add testcase
  • Loading branch information
ringabout authored and ardek66 committed Mar 26, 2021
1 parent c984ca0 commit 2f1057e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/js/asyncjs.nim
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,11 @@ proc generateJsasync(arg: NimNode): NimNode =
var resolve: NimNode
if isVoid:
resolve = quote:
var `jsResolve` {.importcpp: "undefined".}: Future[void]
var `jsResolve` {.importjs: "undefined".}: Future[void]
else:
resolve = quote:
proc jsResolve[T](a: T): Future[T] {.importcpp: "#", used.}
proc jsResolve[T](a: T): Future[T] {.importjs: "#", used.}
proc jsResolve[T](a: Future[T]): Future[T] {.importjs: "#", used.}
result.body.add(resolve)
else:
result.body = newEmptyNode()
Expand Down
10 changes: 10 additions & 0 deletions tests/js/t17177.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import std/asyncjs

proc fn1(n: int): Future[int] {.async.} = return n
proc main2() =
proc fn2(n: int): Future[int] {.async.} = return n
proc main3(a: auto) =
proc fn3(n: int): Future[int] {.async.} = return n
proc main4() {.async.} =
proc fn4(n: int): Future[int] {.async.} = return n
discard

0 comments on commit 2f1057e

Please sign in to comment.