Skip to content
Snippets Groups Projects
Commit d61ac655 authored by Regis Blanc's avatar Regis Blanc
Browse files

should still transform the body even without side effects

parent 8f70c971
Branches
Tags
No related merge requests found
...@@ -254,6 +254,10 @@ object ImperativeCodeElimination extends UnitPhase[Program] { ...@@ -254,6 +254,10 @@ object ImperativeCodeElimination extends UnitPhase[Program] {
case LetDef(fd, b) => case LetDef(fd, b) =>
def fdWithoutSideEffects = { def fdWithoutSideEffects = {
fd.body.foreach { bd =>
val (fdRes, fdScope, _) = toFunction(bd)
fd.body = Some(fdScope(fdRes))
}
val (bodyRes, bodyScope, bodyFun) = toFunction(b) val (bodyRes, bodyScope, bodyFun) = toFunction(b)
(bodyRes, (b2: Expr) => LetDef(fd, bodyScope(b2)).copiedFrom(expr), bodyFun) (bodyRes, (b2: Expr) => LetDef(fd, bodyScope(b2)).copiedFrom(expr), bodyFun)
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment