fix #20866 [ORC] Bad codegen for global pointer to iterator (#20876)

This commit is contained in:
Bung 2022-11-23 03:05:16 +08:00 • committed by GitHub
commit 354eb2a86c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 3 deletions

View file

@ -593,9 +593,12 @@ proc msgSymChoiceUseQualifier(c: PContext; n: PNode; note = errGenerated) =
template isLocalVarSym(n: PNode): bool =
n.kind == nkSym and
n.sym.kind in {skVar, skLet} and not
(n.sym.kind in {skVar, skLet} and not
({sfGlobal, sfPure} <= n.sym.flags or
sfCompileTime in n.sym.flags)
sfCompileTime in n.sym.flags) or
n.sym.kind in {skProc, skFunc, skIterator} and
sfGlobal notin n.sym.flags
)
proc usesLocalVar(n: PNode): bool =
for z in 1 ..< n.len: