Skip to content
Snippets Groups Projects
Commit bd5ec205 authored by Marco Antognini's avatar Marco Antognini Committed by Etienne Kneuss
Browse files

Remove code duplication in translated while statement

parent 5fe42a43
Branches
Tags
No related merge requests found
...@@ -413,8 +413,8 @@ class CConverter(val ctx: LeonContext, val prog: Program) { ...@@ -413,8 +413,8 @@ class CConverter(val ctx: LeonContext, val prog: Program) {
// Transform while (cond) { body } into // Transform while (cond) { body } into
// while (true) { if (cond) { body } else { break } } // while (true) { if (cond) { body } else { break } }
val condF = flatten(cond) val condF = flatten(cond)
val ifelse = condF.body ~~ buildIfElse(condF.value, body, CAST.Break) val ifelse = condF.body ~~ buildIfElse(condF.value, CAST.NoStmt, CAST.Break)
CAST.While(CAST.True, ifelse) CAST.While(CAST.True, ifelse ~ body)
} }
case FunctionInvocation(tfd @ TypedFunDef(fd, _), stdArgs) => case FunctionInvocation(tfd @ TypedFunDef(fd, _), stdArgs) =>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment