mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
thread top-level expect region through
This commit is contained in:
parent
7e5476aa58
commit
9d294b459e
6 changed files with 83 additions and 26 deletions
|
@ -1,9 +1,11 @@
|
|||
use bumpalo::collections::Vec as BumpVec;
|
||||
use bumpalo::Bump;
|
||||
use const_format::concatcp;
|
||||
use inkwell::context::Context;
|
||||
use libloading::Library;
|
||||
use roc_gen_llvm::llvm::build::LlvmBackendMode;
|
||||
use roc_module::symbol::Symbol;
|
||||
use roc_region::all::Region;
|
||||
use roc_types::subs::Subs;
|
||||
use rustyline::highlight::{Highlighter, PromptInfo};
|
||||
use rustyline::validate::{self, ValidationContext, ValidationResult, Validator};
|
||||
|
@ -193,19 +195,20 @@ impl ReplAppMemory for CliMemory {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct ToplevelExpect<'a> {
|
||||
pub name: &'a str,
|
||||
pub symbol: Symbol,
|
||||
pub region: Region,
|
||||
}
|
||||
|
||||
pub fn expect_mono_module_to_dylib<'a>(
|
||||
arena: &'a Bump,
|
||||
target: Triple,
|
||||
loaded: MonomorphizedModule<'a>,
|
||||
opt_level: OptLevel,
|
||||
mode: LlvmBackendMode,
|
||||
) -> Result<
|
||||
(
|
||||
libloading::Library,
|
||||
bumpalo::collections::Vec<'a, (Symbol, &'a str)>,
|
||||
),
|
||||
libloading::Error,
|
||||
> {
|
||||
) -> Result<(libloading::Library, BumpVec<'a, ToplevelExpect<'a>>), libloading::Error> {
|
||||
let target_info = TargetInfo::from(&target);
|
||||
|
||||
let MonomorphizedModule {
|
||||
|
@ -250,13 +253,20 @@ pub fn expect_mono_module_to_dylib<'a>(
|
|||
let expect_names = roc_gen_llvm::llvm::build::build_procedures_expose_expects(
|
||||
&env,
|
||||
opt_level,
|
||||
&toplevel_expects,
|
||||
toplevel_expects.unzip_slices().0,
|
||||
procedures,
|
||||
entry_point,
|
||||
);
|
||||
|
||||
let expects = bumpalo::collections::Vec::from_iter_in(
|
||||
toplevel_expects.into_iter().zip(expect_names.into_iter()),
|
||||
toplevel_expects
|
||||
.into_iter()
|
||||
.zip(expect_names.into_iter())
|
||||
.map(|((symbol, region), name)| ToplevelExpect {
|
||||
symbol,
|
||||
region,
|
||||
name,
|
||||
}),
|
||||
env.arena,
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue