mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-01 07:41:12 +00:00
We got a test working for panicking with the appropriate number fo failures. Ultimatly we want:
+ An error maessage that says what the failures were + Not panicking (so these are effectively error productions)
This commit is contained in:
parent
085c02ffee
commit
4f8d0776b3
8 changed files with 103 additions and 24 deletions
|
@ -6030,7 +6030,10 @@ fn run_low_level<'a, 'ctx, 'env>(
|
|||
{
|
||||
bd.position_at_end(throw_block);
|
||||
|
||||
let func = env.module.get_function("roc_builtins.utils.expect_failed").unwrap();
|
||||
let func = env
|
||||
.module
|
||||
.get_function("roc_builtins.utils.expect_failed")
|
||||
.unwrap();
|
||||
let callable = CallableValue::try_from(func).unwrap();
|
||||
let start_line = context.i32_type().const_int(0, false);
|
||||
let end_line = context.i32_type().const_int(0, false);
|
||||
|
@ -6039,7 +6042,12 @@ fn run_low_level<'a, 'ctx, 'env>(
|
|||
|
||||
bd.build_call(
|
||||
callable,
|
||||
&[start_line.into(), end_line.into(), start_col.into(), end_col.into()],
|
||||
&[
|
||||
start_line.into(),
|
||||
end_line.into(),
|
||||
start_col.into(),
|
||||
end_col.into(),
|
||||
],
|
||||
"call_expect_failed",
|
||||
);
|
||||
|
||||
|
|
|
@ -42,6 +42,43 @@ pub fn add_default_roc_externs(env: &Env<'_, '_, '_>) {
|
|||
}
|
||||
}
|
||||
|
||||
// roc_memcpy
|
||||
{
|
||||
// The type of this function (but not the implementation) should have
|
||||
// already been defined by the builtins, which rely on it.
|
||||
let fn_val = module.get_function("roc_memcpy").unwrap();
|
||||
let mut params = fn_val.get_param_iter();
|
||||
let dest_arg = params.next().unwrap();
|
||||
let dest_alignment = 1;
|
||||
let src_arg = params.next().unwrap();
|
||||
let src_alignment = 1;
|
||||
let bytes_arg = params.next().unwrap();
|
||||
|
||||
debug_assert!(params.next().is_none());
|
||||
|
||||
// Add a basic block for the entry point
|
||||
let entry = ctx.append_basic_block(fn_val, "entry");
|
||||
|
||||
builder.position_at_end(entry);
|
||||
|
||||
// Call libc memcpy()
|
||||
let _retval = builder
|
||||
.build_memcpy(
|
||||
dest_arg.into_pointer_value(),
|
||||
dest_alignment,
|
||||
src_arg.into_pointer_value(),
|
||||
src_alignment,
|
||||
bytes_arg.into_int_value(),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
builder.build_return(None);
|
||||
|
||||
if cfg!(debug_assertions) {
|
||||
crate::llvm::build::verify_fn(fn_val);
|
||||
}
|
||||
}
|
||||
|
||||
// roc_realloc
|
||||
{
|
||||
let libc_realloc_val = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue