mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 05:49:08 +00:00
make ROC_DEV_WRITE_OBJ work in more cases
This commit is contained in:
parent
076fafe02f
commit
919a51137a
2 changed files with 22 additions and 6 deletions
|
@ -29,6 +29,28 @@ pub fn build_module<'a, 'r>(
|
|||
layout_interner: &'r mut STLayoutInterner<'a>,
|
||||
target: &Triple,
|
||||
procedures: MutMap<(symbol::Symbol, ProcLayout<'a>), Proc<'a>>,
|
||||
) -> Object<'a> {
|
||||
let module_object = build_module_help(env, interns, layout_interner, target, procedures);
|
||||
|
||||
if std::env::var("ROC_DEV_WRITE_OBJ").is_ok() {
|
||||
let module_out = module_object
|
||||
.write()
|
||||
.expect("failed to build output object");
|
||||
|
||||
let file_path = std::env::temp_dir().join("app.o");
|
||||
println!("gen-test object file written to {}", file_path.display());
|
||||
std::fs::write(&file_path, module_out).expect("failed to write object to file");
|
||||
}
|
||||
|
||||
module_object
|
||||
}
|
||||
|
||||
fn build_module_help<'a, 'r>(
|
||||
env: &'r Env<'a>,
|
||||
interns: &'r mut Interns,
|
||||
layout_interner: &'r mut STLayoutInterner<'a>,
|
||||
target: &Triple,
|
||||
procedures: MutMap<(symbol::Symbol, ProcLayout<'a>), Proc<'a>>,
|
||||
) -> Object<'a> {
|
||||
match target {
|
||||
Triple {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue