Fixed yield in nkObjConstr. Fixes #9694 [backport] (#9744)

* Fixed yield in nkObjConstr. Fixes #9694
* Separate expr lowering from state splitting, introduce a clear lowering internal error
This commit is contained in:
Yuriy Glukhov 2018-11-19 00:09:33 +02:00 • committed by Andreas Rumpf
commit 5a2290f788
2 changed files with 30 additions and 9 deletions

View file

@ -440,4 +440,19 @@ block:
test(it, 1, 2, 5)
block: #9694 - yield in ObjConstr
type Foo = object
a, b: int
template yieldAndNum: int =
yield 1
2
iterator it(): int {.closure.} =
let a = Foo(a: 5, b: yieldAndNum())
checkpoint(a.b)
test(it, 1, 2)
echo "ok"