mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 00:24:34 +00:00
fix repl
This commit is contained in:
parent
85cd59dbae
commit
a4903ccf81
1 changed files with 15 additions and 6 deletions
|
@ -3256,7 +3256,9 @@ fn expose_function_to_host_help_c_abi<'a, 'ctx, 'env>(
|
||||||
let cc_return = to_cc_return(env, &return_layout);
|
let cc_return = to_cc_return(env, &return_layout);
|
||||||
|
|
||||||
let c_function_type = match cc_return {
|
let c_function_type = match cc_return {
|
||||||
CCReturn::Void => env.context.void_type().fn_type(&argument_types, false),
|
CCReturn::Void if !env.is_gen_test => {
|
||||||
|
env.context.void_type().fn_type(&argument_types, false)
|
||||||
|
}
|
||||||
CCReturn::Return if !env.is_gen_test => return_type.fn_type(&argument_types, false),
|
CCReturn::Return if !env.is_gen_test => return_type.fn_type(&argument_types, false),
|
||||||
_ => {
|
_ => {
|
||||||
let output_type = return_type.ptr_type(AddressSpace::Generic);
|
let output_type = return_type.ptr_type(AddressSpace::Generic);
|
||||||
|
@ -3291,8 +3293,17 @@ fn expose_function_to_host_help_c_abi<'a, 'ctx, 'env>(
|
||||||
let mut args = args_vector.as_slice();
|
let mut args = args_vector.as_slice();
|
||||||
let args_length = args.len();
|
let args_length = args.len();
|
||||||
|
|
||||||
if let CCReturn::ByPointer = cc_return {
|
match cc_return {
|
||||||
args = &args[..args.len() - 1];
|
CCReturn::Return if !env.is_gen_test => {
|
||||||
|
debug_assert_eq!(args.len(), roc_function.get_params().len());
|
||||||
|
}
|
||||||
|
CCReturn::Void if !env.is_gen_test => {
|
||||||
|
debug_assert_eq!(args.len(), roc_function.get_params().len());
|
||||||
|
}
|
||||||
|
_ => {
|
||||||
|
args = &args[..args.len() - 1];
|
||||||
|
debug_assert_eq!(args.len(), roc_function.get_params().len());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut arguments_for_call = Vec::with_capacity_in(args.len(), env.arena);
|
let mut arguments_for_call = Vec::with_capacity_in(args.len(), env.arena);
|
||||||
|
@ -3311,8 +3322,6 @@ fn expose_function_to_host_help_c_abi<'a, 'ctx, 'env>(
|
||||||
|
|
||||||
let arguments_for_call = &arguments_for_call.into_bump_slice();
|
let arguments_for_call = &arguments_for_call.into_bump_slice();
|
||||||
|
|
||||||
debug_assert_eq!(args.len(), roc_function.get_params().len());
|
|
||||||
|
|
||||||
let call_result = {
|
let call_result = {
|
||||||
if env.is_gen_test {
|
if env.is_gen_test {
|
||||||
let roc_wrapper_function = make_exception_catcher(env, roc_function);
|
let roc_wrapper_function = make_exception_catcher(env, roc_function);
|
||||||
|
@ -3344,7 +3353,7 @@ fn expose_function_to_host_help_c_abi<'a, 'ctx, 'env>(
|
||||||
};
|
};
|
||||||
|
|
||||||
match cc_return {
|
match cc_return {
|
||||||
CCReturn::Void => {
|
CCReturn::Void if !env.is_gen_test => {
|
||||||
// TODO return empty struct here?
|
// TODO return empty struct here?
|
||||||
builder.build_return(None);
|
builder.build_return(None);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue