mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-01 15:51:12 +00:00
always Cond on a symbol
this will make 'beans' easier
This commit is contained in:
parent
3dbdb64a93
commit
2bb69f333f
6 changed files with 192 additions and 104 deletions
|
@ -1105,16 +1105,32 @@ fn decide_to_branching<'a>(
|
|||
jumps,
|
||||
));
|
||||
|
||||
let cond = boolean_all(env.arena, tests);
|
||||
let condition = boolean_all(env.arena, tests);
|
||||
|
||||
let cond_layout = Layout::Builtin(Builtin::Bool);
|
||||
|
||||
Expr::Cond {
|
||||
cond: env.arena.alloc(cond),
|
||||
cond_layout,
|
||||
pass,
|
||||
fail,
|
||||
ret_layout,
|
||||
if let Expr::Load(symbol) = condition {
|
||||
Expr::Cond {
|
||||
cond: symbol,
|
||||
cond_layout,
|
||||
pass,
|
||||
fail,
|
||||
ret_layout,
|
||||
}
|
||||
} else {
|
||||
let cond_symbol = env.fresh_symbol();
|
||||
let stores = vec![(cond_symbol, cond_layout.clone(), condition)];
|
||||
|
||||
Expr::Store(
|
||||
env.arena.alloc(stores),
|
||||
env.arena.alloc(Expr::Cond {
|
||||
cond: cond_symbol,
|
||||
cond_layout,
|
||||
pass,
|
||||
fail,
|
||||
ret_layout,
|
||||
}),
|
||||
)
|
||||
}
|
||||
}
|
||||
FanOut {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue