parent
763fef59fa
commit
c80261bc00
2 changed files with 14 additions and 4 deletions
|
|
@ -2412,10 +2412,13 @@ when notJSnotNims:
|
||||||
{.error: "Only closure function and iterator are allowed!".}
|
{.error: "Only closure function and iterator are allowed!".}
|
||||||
|
|
||||||
proc finished*[T: proc](x: T): bool {.noSideEffect, inline.} =
|
proc finished*[T: proc](x: T): bool {.noSideEffect, inline.} =
|
||||||
## can be used to determine if a first class iterator has finished.
|
## It can be used to determine if a first class iterator has finished.
|
||||||
{.emit: """
|
when T is "iterator":
|
||||||
`result` = ((NI*) `x`.ClE_0)[1] < 0;
|
{.emit: """
|
||||||
""".}
|
`result` = ((NI*) `x`.ClE_0)[1] < 0;
|
||||||
|
""".}
|
||||||
|
else:
|
||||||
|
{.error: "Only closure iterator is allowed!".}
|
||||||
|
|
||||||
when defined(js):
|
when defined(js):
|
||||||
include "system/jssys"
|
include "system/jssys"
|
||||||
|
|
|
||||||
|
|
@ -210,3 +210,10 @@ block: # Ordinal
|
||||||
# doAssert enum is Ordinal # fails
|
# doAssert enum is Ordinal # fails
|
||||||
# doAssert Ordinal is SomeOrdinal
|
# doAssert Ordinal is SomeOrdinal
|
||||||
# doAssert SomeOrdinal is Ordinal
|
# doAssert SomeOrdinal is Ordinal
|
||||||
|
|
||||||
|
block:
|
||||||
|
proc p() = discard
|
||||||
|
|
||||||
|
doAssert not compiles(echo p.rawProc.repr)
|
||||||
|
doAssert not compiles(echo p.rawEnv.repr)
|
||||||
|
doAssert not compiles(echo p.finished)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue