Error: cps doesn't know how to rewrite this into assignment:
zevv opened this issue · comments
Ico Doornekamp commented
import cps
type
C = Continuation
P = object
val: int
proc bar(c: C): C {.cpsMagic.} =
c
proc foo(p: P): int {.cps:C.} =
bar()
p.val
echo foo(P())
/tmp/t.nim(13, 23) template/generic instantiation of `cps` from here
/tmp/t.nim(14, 3) template/generic instantiation of `cpsAsgn` from here
/tmp/t.nim(15, 4) Error: cps doesn't know how to rewrite this into assignment:
DotExpr
Sym "p"
Sym "val"
Saem Ghani commented
@alaviss is this a matter of exprs.assignTo
(or futher up) understanding that the last expression in a proc that otherwise doesn't have mention of result
is a return?
So the trick would be detecting that and then handling the case in exprs.filterExpr
?