summary refs log tree commit diff stats
path: root/compiler/semstmts.nim
diff options
context:
space:
mode:
authorBung <crc32@qq.com>2022-11-23 03:05:16 +0800
committerGitHub <noreply@github.com>2022-11-22 20:05:16 +0100
commit354eb2a86c75335c34cab8074b8b3532f09ecccf (patch)
tree43ab59e153a06e1ebe30740240a61fe17b5b8462 /compiler/semstmts.nim
parentfc37554795f02924cded5500a93233e28d6634db (diff)
downloadNim-354eb2a86c75335c34cab8074b8b3532f09ecccf.tar.gz
fix #20866 [ORC] Bad codegen for global pointer to iterator (#20876)
Diffstat (limited to 'compiler/semstmts.nim')
-rw-r--r--compiler/semstmts.nim7
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim
index 774b50d7b..ab8c23ba4 100644
--- a/compiler/semstmts.nim
+++ b/compiler/semstmts.nim
@@ -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: