mirror of
https://github.com/roc-lang/roc.git
synced 2024-11-10 10:02:38 +03:00
only generate roc panic if running tests
This commit is contained in:
parent
cec6d7424e
commit
1856695b0b
@ -45,6 +45,13 @@ impl AssemblyBackendMode {
|
||||
AssemblyBackendMode::Test => true,
|
||||
}
|
||||
}
|
||||
|
||||
fn generate_roc_panic(self) -> bool {
|
||||
match self {
|
||||
AssemblyBackendMode::Binary => false,
|
||||
AssemblyBackendMode::Test => true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Env<'a> {
|
||||
|
@ -1,5 +1,5 @@
|
||||
use crate::generic64::{aarch64, new_backend_64bit, x86_64};
|
||||
use crate::{Backend, Env, Relocation};
|
||||
use crate::{AssemblyBackendMode, Backend, Env, Relocation};
|
||||
use bumpalo::collections::Vec;
|
||||
use object::write::{self, SectionId, SymbolId};
|
||||
use object::write::{Object, StandardSection, StandardSegment, Symbol, SymbolSection};
|
||||
@ -312,11 +312,13 @@ fn build_object<'a, B: Backend<'a>>(
|
||||
);
|
||||
*/
|
||||
|
||||
if backend.env().mode.generate_roc_panic() {
|
||||
define_setlongjmp_buffer(&mut output);
|
||||
|
||||
generate_roc_panic(&mut backend, &mut output);
|
||||
generate_setjmp(&mut backend, &mut output);
|
||||
generate_longjmp(&mut backend, &mut output);
|
||||
}
|
||||
|
||||
if backend.env().mode.generate_allocators() {
|
||||
generate_wrapper(
|
||||
@ -402,6 +404,7 @@ fn build_object<'a, B: Backend<'a>>(
|
||||
|
||||
// println!("{}", test_helper.to_pretty(backend.interner(), 200, true));
|
||||
|
||||
if let AssemblyBackendMode::Test = backend.env().mode {
|
||||
build_proc_symbol(
|
||||
&mut output,
|
||||
&mut layout_ids,
|
||||
@ -411,6 +414,7 @@ fn build_object<'a, B: Backend<'a>>(
|
||||
test_helper,
|
||||
Exposed::TestMain,
|
||||
);
|
||||
}
|
||||
|
||||
build_proc_symbol(
|
||||
&mut output,
|
||||
|
Loading…
Reference in New Issue
Block a user