mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 16:44:33 +00:00
Refactor Expect mono::ir generation a bit
This commit is contained in:
parent
af7eda34a0
commit
80fc129dd4
1 changed files with 8 additions and 13 deletions
|
@ -5414,25 +5414,20 @@ pub fn from_can<'a>(
|
||||||
lookups_in_cond,
|
lookups_in_cond,
|
||||||
} => {
|
} => {
|
||||||
let rest = from_can(env, variable, loc_continuation.value, procs, layout_cache);
|
let rest = from_can(env, variable, loc_continuation.value, procs, layout_cache);
|
||||||
|
|
||||||
let bool_layout = Layout::Builtin(Builtin::Bool);
|
|
||||||
let cond_symbol = env.unique_symbol();
|
let cond_symbol = env.unique_symbol();
|
||||||
|
|
||||||
let op = LowLevel::ExpectTrue;
|
|
||||||
let call_type = CallType::LowLevel {
|
let call_type = CallType::LowLevel {
|
||||||
op,
|
op: LowLevel::ExpectTrue,
|
||||||
update_mode: env.next_update_mode_id(),
|
update_mode: env.next_update_mode_id(),
|
||||||
};
|
};
|
||||||
let arguments = env.arena.alloc([cond_symbol]);
|
let arguments = env.arena.alloc([cond_symbol]);
|
||||||
let call = self::Call {
|
|
||||||
call_type,
|
|
||||||
arguments,
|
|
||||||
};
|
|
||||||
|
|
||||||
let rest = Stmt::Let(
|
let stmt = Stmt::Let(
|
||||||
env.unique_symbol(),
|
env.unique_symbol(),
|
||||||
Expr::Call(call),
|
Expr::Call(self::Call {
|
||||||
bool_layout,
|
call_type,
|
||||||
|
arguments,
|
||||||
|
}),
|
||||||
|
Layout::Builtin(Builtin::Bool),
|
||||||
env.arena.alloc(rest),
|
env.arena.alloc(rest),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -5443,7 +5438,7 @@ pub fn from_can<'a>(
|
||||||
procs,
|
procs,
|
||||||
layout_cache,
|
layout_cache,
|
||||||
cond_symbol,
|
cond_symbol,
|
||||||
env.arena.alloc(rest),
|
env.arena.alloc(stmt),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue