mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-07 13:33:22 +00:00
Closure iterators are not supported by VM (#15818)
(cherry picked from commit 5b4c17b5e7)
This commit is contained in:
@@ -1982,6 +1982,8 @@ proc gen(c: PCtx; n: PNode; dest: var TDest; flags: TGenFlags = {}) =
|
||||
genRdVar(c, n, dest, flags)
|
||||
of skProc, skFunc, skConverter, skMacro, skTemplate, skMethod, skIterator:
|
||||
# 'skTemplate' is only allowed for 'getAst' support:
|
||||
if s.kind == skIterator and s.typ.callConv == TCallingConvention.ccClosure:
|
||||
globalError(c.config, n.info, "Closure iterators are not supported by VM!")
|
||||
if procIsCallback(c, s): discard
|
||||
elif importcCond(s): c.importcSym(n.info, s)
|
||||
genLit(c, n, dest)
|
||||
|
||||
9
tests/vm/tclosureiterator.nim
Normal file
9
tests/vm/tclosureiterator.nim
Normal file
@@ -0,0 +1,9 @@
|
||||
discard """
|
||||
errormsg: "Closure iterators are not supported by VM!"
|
||||
"""
|
||||
|
||||
iterator iter*(): int {.closure.} =
|
||||
yield 3
|
||||
|
||||
static:
|
||||
var x = iter
|
||||
Reference in New Issue
Block a user