mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-29 19:57:58 +00:00
enable closures tests for JS & implement finished for JS (#23521)
This commit is contained in:
@@ -2350,8 +2350,14 @@ when notJSnotNims:
|
||||
`result` = `x`.ClE_0;
|
||||
""".}
|
||||
|
||||
proc finished*[T: iterator {.closure.}](x: T): bool {.noSideEffect, inline, magic: "Finished".} =
|
||||
## It can be used to determine if a first class iterator has finished.
|
||||
proc finished*[T: iterator {.closure.}](x: T): bool {.noSideEffect, inline, magic: "Finished".} =
|
||||
## It can be used to determine if a first class iterator has finished.
|
||||
when defined(js):
|
||||
# TODO: mangle `:state`
|
||||
{.emit: """
|
||||
`result` = (`x`.ClE_0).HEX3Astate < 0;
|
||||
""".}
|
||||
else:
|
||||
{.emit: """
|
||||
`result` = ((NI*) `x`.ClE_0)[1] < 0;
|
||||
""".}
|
||||
|
||||
Reference in New Issue
Block a user