mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 21:39:07 +00:00
Remove expect-fx syntax and handling
This was never fully hooked up in platforms, and the plan is to replace the need for this with doing purity-inference on normal `expect` statements. On the other hand, fuzzing is finding some bugs caused by having a hyphenated keyword, so this is a great time to go ahead and remove it!
This commit is contained in:
parent
7bf3701c9e
commit
9ead801536
32 changed files with 21 additions and 641 deletions
|
@ -3650,74 +3650,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