summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2023-08-14 19:08:01 +0800
committerGitHub <noreply@github.com>2023-08-14 13:08:01 +0200
commit09d0fda7fde69087c75a102b219d5eebf1b86db2 (patch)
treecbbccf0ea9b996cce2fab04a7f78c27bd1a836d9 /compiler
parent7bb2462d06b039b70e13b68ee2b23c39a881ca26 (diff)
downloadNim-09d0fda7fde69087c75a102b219d5eebf1b86db2.tar.gz
fixes #22469; generates nimTestErrorFlag for top level statements (#22472)
fixes #22469; generates `nimTestErrorFlag` for top level statements
Diffstat (limited to 'compiler')
-rw-r--r--compiler/cgen.nim4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/cgen.nim b/compiler/cgen.nim
index 5aafc506b..811f89983 100644
--- a/compiler/cgen.nim
+++ b/compiler/cgen.nim
@@ -1875,13 +1875,13 @@ proc genInitCode(m: BModule) =
     if beforeRetNeeded in m.initProc.flags:
       prc.add("\tBeforeRet_: ;\n")
 
-    if sfMainModule in m.module.flags and m.config.exc == excGoto:
+    if m.config.exc == excGoto:
       if getCompilerProc(m.g.graph, "nimTestErrorFlag") != nil:
         m.appcg(prc, "\t#nimTestErrorFlag();$n", [])
 
     if optStackTrace in m.initProc.options and preventStackTrace notin m.flags:
       prc.add(deinitFrame(m.initProc))
-  elif sfMainModule in m.module.flags and m.config.exc == excGoto:
+  elif m.config.exc == excGoto:
     if getCompilerProc(m.g.graph, "nimTestErrorFlag") != nil:
       m.appcg(prc, "\t#nimTestErrorFlag();$n", [])