mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 22:34:45 +00:00
stop passing stdlib (use lazy_static)
This commit is contained in:
parent
f25afe4629
commit
d8fa2b8d92
12 changed files with 14 additions and 89 deletions
|
@ -26,7 +26,6 @@ fn promote_expr_to_module(src: &str) -> String {
|
|||
pub fn helper(
|
||||
arena: &bumpalo::Bump,
|
||||
src: &str,
|
||||
stdlib: roc_builtins::std::StdLib,
|
||||
_leak: bool,
|
||||
lazy_literals: bool,
|
||||
) -> (String, Vec<roc_problem::can::Problem>, Library) {
|
||||
|
@ -52,7 +51,6 @@ pub fn helper(
|
|||
arena,
|
||||
filename,
|
||||
module_src,
|
||||
&stdlib,
|
||||
src_dir,
|
||||
Default::default(),
|
||||
roc_target::TargetInfo::default_x86_64(),
|
||||
|
@ -239,11 +237,10 @@ macro_rules! assert_evals_to {
|
|||
($src:expr, $expected:expr, $ty:ty, $transform:expr, $leak:expr, $lazy_literals:expr) => {
|
||||
use bumpalo::Bump;
|
||||
use roc_gen_dev::run_jit_function_raw;
|
||||
let stdlib = roc_builtins::std::standard_stdlib();
|
||||
|
||||
let arena = Bump::new();
|
||||
let (main_fn_name, errors, lib) =
|
||||
$crate::helpers::dev::helper(&arena, $src, stdlib, $leak, $lazy_literals);
|
||||
$crate::helpers::dev::helper(&arena, $src, $leak, $lazy_literals);
|
||||
|
||||
let transform = |success| {
|
||||
let expected = $expected;
|
||||
|
|
|
@ -26,7 +26,6 @@ fn promote_expr_to_module(src: &str) -> String {
|
|||
fn create_llvm_module<'a>(
|
||||
arena: &'a bumpalo::Bump,
|
||||
src: &str,
|
||||
stdlib: &'a roc_builtins::std::StdLib,
|
||||
is_gen_test: bool,
|
||||
ignore_problems: bool,
|
||||
context: &'a inkwell::context::Context,
|
||||
|
@ -55,7 +54,6 @@ fn create_llvm_module<'a>(
|
|||
arena,
|
||||
filename,
|
||||
module_src,
|
||||
stdlib,
|
||||
src_dir,
|
||||
Default::default(),
|
||||
target_info,
|
||||
|
@ -260,7 +258,6 @@ fn create_llvm_module<'a>(
|
|||
pub fn helper<'a>(
|
||||
arena: &'a bumpalo::Bump,
|
||||
src: &str,
|
||||
stdlib: &'a roc_builtins::std::StdLib,
|
||||
is_gen_test: bool,
|
||||
ignore_problems: bool,
|
||||
context: &'a inkwell::context::Context,
|
||||
|
@ -276,7 +273,6 @@ pub fn helper<'a>(
|
|||
let (main_fn_name, delayed_errors, module) = create_llvm_module(
|
||||
arena,
|
||||
src,
|
||||
stdlib,
|
||||
is_gen_test,
|
||||
ignore_problems,
|
||||
context,
|
||||
|
@ -305,7 +301,6 @@ fn wasm32_target_tripple() -> Triple {
|
|||
pub fn helper_wasm<'a>(
|
||||
arena: &'a bumpalo::Bump,
|
||||
src: &str,
|
||||
stdlib: &'a roc_builtins::std::StdLib,
|
||||
_is_gen_test: bool,
|
||||
ignore_problems: bool,
|
||||
context: &'a inkwell::context::Context,
|
||||
|
@ -322,7 +317,6 @@ pub fn helper_wasm<'a>(
|
|||
let (_main_fn_name, _delayed_errors, llvm_module) = create_llvm_module(
|
||||
arena,
|
||||
src,
|
||||
stdlib,
|
||||
is_gen_test,
|
||||
ignore_problems,
|
||||
context,
|
||||
|
@ -464,18 +458,9 @@ where
|
|||
let arena = bumpalo::Bump::new();
|
||||
let context = inkwell::context::Context::create();
|
||||
|
||||
// NOTE the stdlib must be in the arena; just taking a reference will segfault
|
||||
let stdlib = arena.alloc(roc_builtins::std::standard_stdlib());
|
||||
|
||||
let is_gen_test = true;
|
||||
let instance = crate::helpers::llvm::helper_wasm(
|
||||
&arena,
|
||||
src,
|
||||
stdlib,
|
||||
is_gen_test,
|
||||
ignore_problems,
|
||||
&context,
|
||||
);
|
||||
let instance =
|
||||
crate::helpers::llvm::helper_wasm(&arena, src, is_gen_test, ignore_problems, &context);
|
||||
|
||||
let memory = instance.exports.get_memory("memory").unwrap();
|
||||
|
||||
|
@ -538,18 +523,9 @@ macro_rules! assert_llvm_evals_to {
|
|||
let arena = Bump::new();
|
||||
let context = Context::create();
|
||||
|
||||
// NOTE the stdlib must be in the arena; just taking a reference will segfault
|
||||
let stdlib = arena.alloc(roc_builtins::std::standard_stdlib());
|
||||
|
||||
let is_gen_test = true;
|
||||
let (main_fn_name, errors, lib) = $crate::helpers::llvm::helper(
|
||||
&arena,
|
||||
$src,
|
||||
stdlib,
|
||||
is_gen_test,
|
||||
$ignore_problems,
|
||||
&context,
|
||||
);
|
||||
let (main_fn_name, errors, lib) =
|
||||
$crate::helpers::llvm::helper(&arena, $src, is_gen_test, $ignore_problems, &context);
|
||||
|
||||
let transform = |success| {
|
||||
let expected = $expected;
|
||||
|
@ -615,12 +591,9 @@ macro_rules! assert_expect_failed {
|
|||
let arena = Bump::new();
|
||||
let context = Context::create();
|
||||
|
||||
// NOTE the stdlib must be in the arena; just taking a reference will segfault
|
||||
let stdlib = arena.alloc(roc_builtins::std::standard_stdlib());
|
||||
|
||||
let is_gen_test = true;
|
||||
let (main_fn_name, errors, lib) =
|
||||
$crate::helpers::llvm::helper(&arena, $src, stdlib, is_gen_test, false, &context);
|
||||
$crate::helpers::llvm::helper(&arena, $src, is_gen_test, false, &context);
|
||||
|
||||
let transform = |success| {
|
||||
let expected = $expected;
|
||||
|
|
|
@ -37,13 +37,12 @@ fn promote_expr_to_module(src: &str) -> String {
|
|||
pub fn compile_and_load<'a, T: Wasm32Result>(
|
||||
arena: &'a bumpalo::Bump,
|
||||
src: &str,
|
||||
stdlib: &'a roc_builtins::std::StdLib,
|
||||
_test_wrapper_type_info: PhantomData<T>,
|
||||
) -> wasmer::Instance {
|
||||
let platform_bytes = load_platform_and_builtins();
|
||||
|
||||
let compiled_bytes =
|
||||
compile_roc_to_wasm_bytes(arena, stdlib, &platform_bytes, src, _test_wrapper_type_info);
|
||||
compile_roc_to_wasm_bytes(arena, &platform_bytes, src, _test_wrapper_type_info);
|
||||
|
||||
if DEBUG_LOG_SETTINGS.keep_test_binary {
|
||||
let build_dir_hash = src_hash(src);
|
||||
|
@ -67,7 +66,6 @@ fn src_hash(src: &str) -> u64 {
|
|||
|
||||
fn compile_roc_to_wasm_bytes<'a, T: Wasm32Result>(
|
||||
arena: &'a bumpalo::Bump,
|
||||
stdlib: &'a roc_builtins::std::StdLib,
|
||||
preload_bytes: &[u8],
|
||||
src: &str,
|
||||
_test_wrapper_type_info: PhantomData<T>,
|
||||
|
@ -90,7 +88,6 @@ fn compile_roc_to_wasm_bytes<'a, T: Wasm32Result>(
|
|||
arena,
|
||||
filename,
|
||||
module_src,
|
||||
stdlib,
|
||||
src_dir,
|
||||
Default::default(),
|
||||
roc_target::TargetInfo::default_wasm32(),
|
||||
|
@ -183,10 +180,7 @@ where
|
|||
{
|
||||
let arena = bumpalo::Bump::new();
|
||||
|
||||
// NOTE the stdlib must be in the arena; just taking a reference will segfault
|
||||
let stdlib = arena.alloc(roc_builtins::std::standard_stdlib());
|
||||
|
||||
let instance = crate::helpers::wasm::compile_and_load(&arena, src, stdlib, phantom);
|
||||
let instance = crate::helpers::wasm::compile_and_load(&arena, src, phantom);
|
||||
|
||||
let memory = instance.exports.get_memory(MEMORY_NAME).unwrap();
|
||||
|
||||
|
@ -256,10 +250,7 @@ where
|
|||
{
|
||||
let arena = bumpalo::Bump::new();
|
||||
|
||||
// NOTE the stdlib must be in the arena; just taking a reference will segfault
|
||||
let stdlib = arena.alloc(roc_builtins::std::standard_stdlib());
|
||||
|
||||
let instance = crate::helpers::wasm::compile_and_load(&arena, src, stdlib, phantom);
|
||||
let instance = crate::helpers::wasm::compile_and_load(&arena, src, phantom);
|
||||
|
||||
let memory = instance.exports.get_memory(MEMORY_NAME).unwrap();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue