Fixed yield in dotExpr and nkOfBranch lowering. Closes #7969.
This commit is contained in:
parent
e957d369b1
commit
0ec2b33c50
2 changed files with 39 additions and 2 deletions
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue