fixes #23382; gives compiler errors for closure iterators in JS (#23398)

fixes #23382
follow up https://github.com/nim-lang/Nim/pull/15823
This commit is contained in:
ringabout
2024-03-14 18:12:29 +08:00
committed by GitHub
parent 78c834dd76
commit 7c11da3f22

View File

@@ -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)