Skip to content

Commit 4bde4c2

Browse files
committed
ok
1 parent 84db6b8 commit 4bde4c2

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

compiler/closureiters.nim

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,9 +1330,9 @@ proc replaceDeletedStates(ctx: var Ctx, n: PNode): PNode =
13301330
if c.kind == nkIntLit:
13311331
let idx = c.intVal
13321332
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]
13361336
else:
13371337
n[i] = ctx.replaceDeletedStates(c)
13381338

@@ -1350,7 +1350,6 @@ proc replaceInlinedStates(ctx: var Ctx, n: PNode): PNode =
13501350
else:
13511351
n[i] = ctx.replaceInlinedStates(c)
13521352

1353-
13541353
proc deleteEmptyStates(ctx: var Ctx) =
13551354
# 1. Assign temporary indexes to state labels to facilitate
13561355
# countStateOccurences. Label number will correspond to index in
@@ -1543,7 +1542,7 @@ proc transformClosureIterator*(g: ModuleGraph; idgen: IdGenerator; fn: PSym, n:
15431542
# echo "LOWERED: ", renderTree(n)
15441543

15451544
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")
15471546

15481547
# Splitting transformation
15491548
discard ctx.transformClosureIteratorBody(n, gotoOut)

0 commit comments

Comments
 (0)