mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 22:09:09 +00:00
Merge remote-tracking branch 'remote/main' into upgrade-llvm-zig
This commit is contained in:
commit
2feb5d3c2e
426 changed files with 8889 additions and 4190 deletions
|
@ -3561,74 +3561,6 @@ pub(crate) fn build_exp_stmt<'a, 'ctx>(
|
|||
)
|
||||
}
|
||||
|
||||
ExpectFx {
|
||||
condition: cond_symbol,
|
||||
region,
|
||||
lookups,
|
||||
variables,
|
||||
remainder,
|
||||
} => {
|
||||
let bd = env.builder;
|
||||
let context = env.context;
|
||||
|
||||
let (cond, _cond_layout) = scope.load_symbol_and_layout(cond_symbol);
|
||||
|
||||
let condition = bd.new_build_int_compare(
|
||||
IntPredicate::EQ,
|
||||
cond.into_int_value(),
|
||||
context.bool_type().const_int(1, false),
|
||||
"is_true",
|
||||
);
|
||||
|
||||
let then_block = context.append_basic_block(parent, "then_block");
|
||||
let throw_block = context.append_basic_block(parent, "throw_block");
|
||||
|
||||
bd.new_build_conditional_branch(condition, then_block, throw_block);
|
||||
|
||||
if env.mode.runs_expects() {
|
||||
bd.position_at_end(throw_block);
|
||||
|
||||
match env.target.ptr_width() {
|
||||
roc_target::PtrWidth::Bytes8 => {
|
||||
let shared_memory = SharedMemoryPointer::get(env);
|
||||
|
||||
clone_to_shared_memory(
|
||||
env,
|
||||
layout_interner,
|
||||
scope,
|
||||
layout_ids,
|
||||
&shared_memory,
|
||||
*cond_symbol,
|
||||
*region,
|
||||
lookups,
|
||||
variables,
|
||||
);
|
||||
|
||||
bd.new_build_unconditional_branch(then_block);
|
||||
}
|
||||
roc_target::PtrWidth::Bytes4 => {
|
||||
// temporary WASM implementation
|
||||
throw_internal_exception(env, "An expectation failed!");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
bd.position_at_end(throw_block);
|
||||
bd.new_build_unconditional_branch(then_block);
|
||||
}
|
||||
|
||||
bd.position_at_end(then_block);
|
||||
|
||||
build_exp_stmt(
|
||||
env,
|
||||
layout_interner,
|
||||
layout_ids,
|
||||
func_spec_solutions,
|
||||
scope,
|
||||
parent,
|
||||
remainder,
|
||||
)
|
||||
}
|
||||
|
||||
Crash(sym, tag) => {
|
||||
throw_exception(env, scope, sym, *tag);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue