mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-13 15:26:24 +00:00
Cleanup
This commit is contained in:
parent
6ba6b04a17
commit
23f4d02f81
1 changed files with 3 additions and 35 deletions
|
@ -1,14 +1,11 @@
|
|||
use bumpalo::collections::CollectIn;
|
||||
use inkwell::{
|
||||
types::{FunctionType, PointerType},
|
||||
values::{BasicValueEnum, FunctionValue, PointerValue},
|
||||
AddressSpace,
|
||||
};
|
||||
use roc_error_macros::internal_error;
|
||||
use roc_mono::layout::{
|
||||
FunctionPointer, InLayout, LambdaName, LayoutInterner, LayoutRepr, STLayoutInterner,
|
||||
values::{FunctionValue, PointerValue},
|
||||
};
|
||||
|
||||
use roc_mono::layout::{InLayout, LambdaName, LayoutInterner, STLayoutInterner};
|
||||
|
||||
use super::{
|
||||
build::{function_value_by_func_spec, Env, FuncBorrowSpec, FunctionSpec, RocReturn},
|
||||
convert::{argument_type_from_layout, basic_type_from_layout},
|
||||
|
@ -34,35 +31,6 @@ pub fn function_type<'a, 'ctx>(
|
|||
fn_spec.typ
|
||||
}
|
||||
|
||||
pub fn pointer_type<'a, 'ctx>(
|
||||
env: &Env<'a, 'ctx, '_>,
|
||||
layout_interner: &STLayoutInterner<'a>,
|
||||
function_pointer: FunctionPointer<'a>,
|
||||
) -> PointerType<'ctx> {
|
||||
let function_type = function_type(
|
||||
env,
|
||||
layout_interner,
|
||||
function_pointer.args,
|
||||
function_pointer.ret,
|
||||
);
|
||||
|
||||
function_type.ptr_type(AddressSpace::default())
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
pub fn pointer_type_expecting_layout<'a, 'ctx>(
|
||||
env: &Env<'a, 'ctx, '_>,
|
||||
layout_interner: &STLayoutInterner<'a>,
|
||||
layout: InLayout<'a>,
|
||||
) -> PointerType<'ctx> {
|
||||
let function_pointer = match layout_interner.get_repr(layout) {
|
||||
LayoutRepr::FunctionPointer(function_pointer) => function_pointer,
|
||||
_ => internal_error!("expected function pointer"),
|
||||
};
|
||||
|
||||
pointer_type(env, layout_interner, function_pointer)
|
||||
}
|
||||
|
||||
pub fn build<'a, 'ctx>(env: &Env<'a, 'ctx, '_>, lambda_name: LambdaName<'a>) -> PointerValue<'ctx> {
|
||||
let func_value: FunctionValue<'ctx> =
|
||||
function_value_by_func_spec(env, FuncBorrowSpec::Erased, lambda_name.name());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue