Fixed yield in dotExpr and nkOfBranch lowering. Closes #7969.

This commit is contained in:
Yuriy Glukhov
2018-06-06 16:17:24 +03:00
parent e957d369b1
commit 0ec2b33c50
2 changed files with 39 additions and 2 deletions

View File

@@ -368,5 +368,29 @@ block: # Short cirquits
test(it, 1, 0, 0)
block: #7969
type
SomeObj = object
id: int
iterator it(): int {.closure.} =
template yieldAndSomeObj: SomeObj =
var s: SomeObj
s.id = 2
yield 1
s
checkpoint(yieldAndSomeObj().id)
var i = 5
case i
of 0:
checkpoint(123)
of 1, 2, 5:
checkpoint(3)
else:
checkpoint(123)
test(it, 1, 2, 3)
echo "ok"