mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-29 03:37:55 +00:00
Fixed yield in dotExpr and nkOfBranch lowering. Closes #7969.
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user