summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authormetagn <metagngn@gmail.com>2023-05-26 18:07:37 +0300
committerGitHub <noreply@github.com>2023-05-26 17:07:37 +0200
commit1aaff9dc48337b58d5606cc18c5ba777cab1a0ba (patch)
tree1806309cd8cfbe9841cc68e3e4b524ef134f239f /compiler
parent656706026b2357a6ff195e3f509f793553e95e8a (diff)
downloadNim-1aaff9dc48337b58d5606cc18c5ba777cab1a0ba.tar.gz
fix & add test for basic hot code reloading case (#21915)
fixes #21885
Diffstat (limited to 'compiler')
-rw-r--r--compiler/cgen.nim5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/cgen.nim b/compiler/cgen.nim
index 8c85db2f8..b332c6cd7 100644
--- a/compiler/cgen.nim
+++ b/compiler/cgen.nim
@@ -2180,7 +2180,10 @@ proc finalCodegenActions*(graph: ModuleGraph; m: BModule; n: PNode): PNode =
 
     if m.hcrOn:
       # make sure this is pulled in (meaning hcrGetGlobal() is called for it during init)
-      cgsym(m, "programResult")
+      let sym = magicsys.getCompilerProc(m.g.graph, "programResult")
+      # ignore when not available, could be a module imported early in `system`
+      if sym != nil:
+        cgsymImpl m, sym
       if m.inHcrInitGuard:
         endBlock(m.initProc)