mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 15:21:12 +00:00
remove FunctionPointer completely
This commit is contained in:
parent
c776d98686
commit
f2f9897187
12 changed files with 11 additions and 58 deletions
|
@ -151,9 +151,6 @@ fn build_transform_caller_help<'a, 'ctx, 'env>(
|
|||
}
|
||||
|
||||
match closure_data_layout {
|
||||
Layout::FunctionPointer(_, _) => {
|
||||
// do nothing
|
||||
}
|
||||
Layout::Closure(_, lambda_set, _) => {
|
||||
if let Layout::Struct(&[]) = lambda_set.runtime_representation() {
|
||||
// do nothing
|
||||
|
@ -508,7 +505,6 @@ pub fn build_compare_wrapper<'a, 'ctx, 'env>(
|
|||
let default = [value1, value2];
|
||||
|
||||
let arguments_cast = match closure_data_layout {
|
||||
Layout::FunctionPointer(_, _) => &default,
|
||||
Layout::Closure(_, lambda_set, _) => {
|
||||
if let Layout::Struct(&[]) = lambda_set.runtime_representation() {
|
||||
&default
|
||||
|
|
|
@ -3627,13 +3627,6 @@ pub fn build_proc<'a, 'ctx, 'env>(
|
|||
env, &fn_name, evaluator, name, arguments, closure, result,
|
||||
)
|
||||
}
|
||||
Layout::FunctionPointer(arguments, result) => {
|
||||
// define function size (equal to pointer size) and return value size, e.g.
|
||||
//
|
||||
// * roc__mainForHost_1_Update_size() -> i64
|
||||
// * roc__mainForHost_1_Update_result_size() -> i64
|
||||
build_function_caller(env, &fn_name, name, arguments, result)
|
||||
}
|
||||
|
||||
Layout::Builtin(_) => {}
|
||||
Layout::Struct(_) => {}
|
||||
|
|
|
@ -88,7 +88,7 @@ fn build_hash_layout<'a, 'ctx, 'env>(
|
|||
}
|
||||
},
|
||||
|
||||
Layout::FunctionPointer(_, _) | Layout::Closure(_, _, _) => {
|
||||
Layout::Closure(_, _, _) => {
|
||||
unreachable!("the type system will guarantee these are never hashed")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -658,7 +658,7 @@ pub fn list_keep_errs<'a, 'ctx, 'env>(
|
|||
)
|
||||
}
|
||||
|
||||
pub fn list_keep_result<'a, 'ctx, 'env>(
|
||||
fn list_keep_result<'a, 'ctx, 'env>(
|
||||
env: &Env<'a, 'ctx, 'env>,
|
||||
layout_ids: &mut LayoutIds<'a>,
|
||||
transform: FunctionValue<'ctx>,
|
||||
|
@ -673,7 +673,6 @@ pub fn list_keep_result<'a, 'ctx, 'env>(
|
|||
let builder = env.builder;
|
||||
|
||||
let result_layout = match transform_layout {
|
||||
Layout::FunctionPointer(_, ret) => ret,
|
||||
Layout::Closure(_, _, ret) => ret,
|
||||
_ => unreachable!("not a callable layout"),
|
||||
};
|
||||
|
|
|
@ -195,7 +195,7 @@ fn build_eq<'a, 'ctx, 'env>(
|
|||
}
|
||||
},
|
||||
|
||||
Layout::FunctionPointer(_, _) | Layout::Closure(_, _, _) => {
|
||||
Layout::Closure(_, _, _) => {
|
||||
unreachable!("the type system will guarantee these are never compared")
|
||||
}
|
||||
}
|
||||
|
@ -336,7 +336,7 @@ fn build_neq<'a, 'ctx, 'env>(
|
|||
unreachable!("recursion pointers should never be compared directly")
|
||||
}
|
||||
|
||||
Layout::FunctionPointer(_, _) | Layout::Closure(_, _, _) => {
|
||||
Layout::Closure(_, _, _) => {
|
||||
unreachable!("the type system will guarantee these are never compared")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,6 @@ pub fn basic_type_from_layout<'a, 'ctx, 'env>(
|
|||
use Layout::*;
|
||||
|
||||
match layout {
|
||||
FunctionPointer(args, ret_layout) => basic_type_from_function_layout(env, args, ret_layout),
|
||||
Closure(_args, closure_layout, _ret_layout) => {
|
||||
let closure_data_layout = closure_layout.runtime_representation();
|
||||
basic_type_from_layout(env, &closure_data_layout)
|
||||
|
|
|
@ -750,8 +750,6 @@ fn modify_refcount_layout_build_function<'a, 'ctx, 'env>(
|
|||
Some(function)
|
||||
}
|
||||
},
|
||||
|
||||
FunctionPointer(_, _) => None,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue