summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorLemonBoy <LemonBoy@users.noreply.github.com>2018-09-03 00:32:26 +0200
committerAndreas Rumpf <rumpf_a@web.de>2018-09-03 00:32:26 +0200
commitfd7fd1819c602e2bc986d2cf10dc26ce2ed9ac2e (patch)
tree2f177f2e9806eff7a30416b3d2e08977ce9e7aa2 /compiler
parent1948eadc24c8964b581240dc841e4eb369a1ad36 (diff)
downloadNim-fd7fd1819c602e2bc986d2cf10dc26ce2ed9ac2e.tar.gz
Make sure addGotoOut always inserts its node (#8843)
Fixes #8773
Diffstat (limited to 'compiler')
-rw-r--r--compiler/closureiters.nim2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/closureiters.nim b/compiler/closureiters.nim
index 9e4885b66..71c755d6c 100644
--- a/compiler/closureiters.nim
+++ b/compiler/closureiters.nim
@@ -239,7 +239,7 @@ proc toStmtList(n: PNode): PNode =
 proc addGotoOut(n: PNode, gotoOut: PNode): PNode =
   # Make sure `n` is a stmtlist, and ends with `gotoOut`
   result = toStmtList(n)
-  if result.len != 0 and result.sons[^1].kind != nkGotoState:
+  if result.len == 0 or result.sons[^1].kind != nkGotoState:
     result.add(gotoOut)
 
 proc newTempVar(ctx: var Ctx, typ: PType): PSym =