fix is "closure" (#16552)
This commit is contained in:
parent
d8b1ffc857
commit
b8775bff57
2 changed files with 10 additions and 2 deletions
|
|
@ -408,8 +408,7 @@ proc isOpImpl(c: PContext, n: PNode, flags: TExprFlags): PNode =
|
||||||
of "closure":
|
of "closure":
|
||||||
let t = skipTypes(t1, abstractRange)
|
let t = skipTypes(t1, abstractRange)
|
||||||
res = t.kind == tyProc and
|
res = t.kind == tyProc and
|
||||||
t.callConv == ccClosure and
|
t.callConv == ccClosure
|
||||||
tfIterator notin t.flags
|
|
||||||
of "iterator":
|
of "iterator":
|
||||||
let t = skipTypes(t1, abstractRange)
|
let t = skipTypes(t1, abstractRange)
|
||||||
res = t.kind == tyProc and
|
res = t.kind == tyProc and
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,15 @@ discard """
|
||||||
|
|
||||||
import std/hashes
|
import std/hashes
|
||||||
|
|
||||||
|
|
||||||
|
when not defined(js) and not defined(cpp):
|
||||||
|
block:
|
||||||
|
var x = 12
|
||||||
|
iterator hello(): int {.closure.} =
|
||||||
|
yield x
|
||||||
|
|
||||||
|
discard hash(hello)
|
||||||
|
|
||||||
block hashes:
|
block hashes:
|
||||||
block hashing:
|
block hashing:
|
||||||
var dummy = 0.0
|
var dummy = 0.0
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue