From fd7fd1819c602e2bc986d2cf10dc26ce2ed9ac2e Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Mon, 3 Sep 2018 00:32:26 +0200 Subject: [PATCH] Make sure addGotoOut always inserts its node (#8843) Fixes #8773 --- compiler/closureiters.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/closureiters.nim b/compiler/closureiters.nim index 9e4885b666..71c755d6c1 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 =