Commit 256ce02f authored by Sapphie's avatar Sapphie
Browse files

Implement general case for If in cond

parent f462ed60
......@@ -70,7 +70,16 @@ object CL3ToCPSTranslator extends (S.Tree => C.Tree) {
// If e1 evaluates to false, jump directly to the else cont
case (_, S.Lit(l)) => elseLit(e1, e2, l)
case _ => ???
case _ => // No optimisation.
val aName = Symbol.fresh("ac")
val aCnt = C.Cnt(aName, Seq(), cond(e2)(thnCnt, elsCnt))
val bName = Symbol.fresh("bc")
val bCnt = C.Cnt(bName, Seq(), cond(e3)(thnCnt, elsCnt))
// Not sure if declaring both continuations at once is allowed
// I don't see why not, but I'm not sure
C.LetC(Seq(aCnt, bCnt), cond(e1)(aName, bName))
}
}
/*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment