From 7c11da3f221feeff7029d8802cda0536fc5ab5f0 Mon Sep 17 00:00:00 2001 From: ringabout <43030857+ringabout@users.noreply.github.com> Date: Thu, 14 Mar 2024 18:12:29 +0800 Subject: [PATCH] fixes #23382; gives compiler errors for closure iterators in JS (#23398) fixes #23382 follow up https://github.com/nim-lang/Nim/pull/15823 --- compiler/jsgen.nim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/jsgen.nim b/compiler/jsgen.nim index ffc11789f9..37db6f74f7 100644 --- a/compiler/jsgen.nim +++ b/compiler/jsgen.nim @@ -2959,7 +2959,9 @@ proc gen(p: PProc, n: PNode, r: var TCompRes) = let s = n[namePos].sym discard mangleName(p.module, s) r.res = s.loc.r - if lfNoDecl in s.loc.flags or s.magic notin generatedMagics: discard + if s.kind == skIterator and s.typ.callConv == TCallingConvention.ccClosure: + globalError(p.config, n.info, "Closure iterators are not supported by JS backend!") + elif lfNoDecl in s.loc.flags or s.magic notin generatedMagics: discard elif not p.g.generatedSyms.containsOrIncl(s.id): p.locals.add(genProc(p, s)) of nkType: r.res = genTypeInfo(p, n.typ)