mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 05:49:08 +00:00
repl helper codegen
This commit is contained in:
parent
45ce8e4da6
commit
5557fb7e34
8 changed files with 331 additions and 58 deletions
|
@ -384,43 +384,78 @@ fn build_object<'a, B: Backend<'a>>(
|
|||
let exposed_proc = build_exposed_proc(&mut backend, &proc);
|
||||
let exposed_generic_proc = build_exposed_generic_proc(&mut backend, &proc);
|
||||
|
||||
let mode = backend.env().mode;
|
||||
|
||||
let (module_id, layout_interner, interns, code_gen_help, _) =
|
||||
backend.module_interns_helpers_mut();
|
||||
|
||||
let ident_ids = interns.all_ident_ids.get_mut(&module_id).unwrap();
|
||||
|
||||
let test_helper = roc_mono::code_gen_help::test_helper(
|
||||
code_gen_help,
|
||||
ident_ids,
|
||||
layout_interner,
|
||||
&proc,
|
||||
);
|
||||
match mode {
|
||||
AssemblyBackendMode::Test => {
|
||||
let test_helper = roc_mono::code_gen_help::test_helper(
|
||||
code_gen_help,
|
||||
ident_ids,
|
||||
layout_interner,
|
||||
&proc,
|
||||
);
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
{
|
||||
let module_id = exposed_generic_proc.name.name().module_id();
|
||||
let ident_ids = backend
|
||||
.interns_mut()
|
||||
.all_ident_ids
|
||||
.get_mut(&module_id)
|
||||
.unwrap();
|
||||
module_id.register_debug_idents(ident_ids);
|
||||
}
|
||||
#[cfg(debug_assertions)]
|
||||
{
|
||||
let module_id = exposed_generic_proc.name.name().module_id();
|
||||
let ident_ids = backend
|
||||
.interns_mut()
|
||||
.all_ident_ids
|
||||
.get_mut(&module_id)
|
||||
.unwrap();
|
||||
module_id.register_debug_idents(ident_ids);
|
||||
}
|
||||
|
||||
if let AssemblyBackendMode::Test = mode {
|
||||
if false {
|
||||
println!("{}", test_helper.to_pretty(backend.interner(), 200, true));
|
||||
// println!("{}", test_helper.to_pretty(backend.interner(), 200, true));
|
||||
|
||||
build_proc_symbol(
|
||||
&mut output,
|
||||
&mut layout_ids,
|
||||
&mut procs,
|
||||
&mut backend,
|
||||
layout,
|
||||
test_helper,
|
||||
Exposed::TestMain,
|
||||
);
|
||||
}
|
||||
AssemblyBackendMode::Repl => {
|
||||
let repl_helper = roc_mono::code_gen_help::repl_helper(
|
||||
code_gen_help,
|
||||
ident_ids,
|
||||
layout_interner,
|
||||
&proc,
|
||||
);
|
||||
|
||||
build_proc_symbol(
|
||||
&mut output,
|
||||
&mut layout_ids,
|
||||
&mut procs,
|
||||
&mut backend,
|
||||
layout,
|
||||
test_helper,
|
||||
Exposed::TestMain,
|
||||
);
|
||||
#[cfg(debug_assertions)]
|
||||
{
|
||||
let module_id = exposed_generic_proc.name.name().module_id();
|
||||
let ident_ids = backend
|
||||
.interns_mut()
|
||||
.all_ident_ids
|
||||
.get_mut(&module_id)
|
||||
.unwrap();
|
||||
module_id.register_debug_idents(ident_ids);
|
||||
}
|
||||
|
||||
// println!("{}", repl_helper.to_pretty(backend.interner(), 200, true));
|
||||
|
||||
build_proc_symbol(
|
||||
&mut output,
|
||||
&mut layout_ids,
|
||||
&mut procs,
|
||||
&mut backend,
|
||||
layout,
|
||||
repl_helper,
|
||||
Exposed::TestMain,
|
||||
);
|
||||
}
|
||||
AssemblyBackendMode::Binary => { /* do nothing */ }
|
||||
>>>>>>> 12686f23b (repl helper codegen)
|
||||
}
|
||||
|
||||
build_proc_symbol(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue