@@ -1330,9 +1330,9 @@ proc replaceDeletedStates(ctx: var Ctx, n: PNode): PNode =
1330
1330
if c.kind == nkIntLit:
1331
1331
let idx = c.intVal
1332
1332
if idx >= 0 and idx < ctx.states.len and ctx.states[idx].label == c and ctx.states[idx].deletable:
1333
- let ns = ctx.replaceDeletedStates(ctx.states[idx].body)
1334
- assert(ns .kind == nkStmtList and ns.len == 1 and ns[ 0 ].kind == nkGotoState and ns[ 0 ][ 0 ].kind == nkIntLit )
1335
- n[i] = ns[ 0 ] [0 ]
1333
+ let gt = ctx.replaceDeletedStates(skipStmtList( ctx.states[idx].body) )
1334
+ assert(gt .kind == nkGotoState)
1335
+ n[i] = gt [0 ]
1336
1336
else :
1337
1337
n[i] = ctx.replaceDeletedStates(c)
1338
1338
@@ -1350,7 +1350,6 @@ proc replaceInlinedStates(ctx: var Ctx, n: PNode): PNode =
1350
1350
else :
1351
1351
n[i] = ctx.replaceInlinedStates(c)
1352
1352
1353
-
1354
1353
proc deleteEmptyStates(ctx: var Ctx) =
1355
1354
# 1. Assign temporary indexes to state labels to facilitate
1356
1355
# countStateOccurences. Label number will correspond to index in
@@ -1543,7 +1542,7 @@ proc transformClosureIterator*(g: ModuleGraph; idgen: IdGenerator; fn: PSym, n:
1543
1542
# echo "LOWERED: ", renderTree(n)
1544
1543
1545
1544
if n.hasYieldsInExpressions():
1546
- internalError(ctx.g.config, " yield in expr not lowered" )
1545
+ internalError(ctx.g.config, n.info, " yield in expr not lowered" )
1547
1546
1548
1547
# Splitting transformation
1549
1548
discard ctx.transformClosureIteratorBody(n, gotoOut)
0 commit comments