mirror of
https://github.com/artegoser/ONLang
synced 2024-11-05 20:43:57 +03:00
fix: compilation of the panic hook only on release
This commit is contained in:
parent
1a693e38dd
commit
89f9b31c2b
2 changed files with 12 additions and 10 deletions
|
@ -290,9 +290,10 @@
|
|||
},
|
||||
},
|
||||
|
||||
"fn sum(first, second){ return first+second};",
|
||||
"Run function `sum`",
|
||||
|
||||
["fn sum(first, second){ return first+second}; sum(2,2) = ", { sum: [2, 2] }],
|
||||
["sum(2, 2) = ", { sum: [2, 2] }],
|
||||
|
||||
"\nInput a var",
|
||||
{
|
||||
|
|
19
src/main.rs
19
src/main.rs
|
@ -15,15 +15,16 @@ mod interpreter;
|
|||
use interpreter::Interpreter;
|
||||
|
||||
fn main() {
|
||||
// std::panic::set_hook(Box::new(|info| {
|
||||
// eprint!(
|
||||
// "{msg}",
|
||||
// msg = match info.payload().downcast_ref::<String>() {
|
||||
// None => "Program panicked without a message!",
|
||||
// Some(x) => x,
|
||||
// }
|
||||
// );
|
||||
// }));
|
||||
#[cfg(not(debug_assertions))]
|
||||
std::panic::set_hook(Box::new(|info| {
|
||||
eprint!(
|
||||
"{msg}",
|
||||
msg = match info.payload().downcast_ref::<String>() {
|
||||
None => "Program panicked without a message!",
|
||||
Some(x) => x,
|
||||
}
|
||||
);
|
||||
}));
|
||||
|
||||
let start = Instant::now();
|
||||
let args = Args::parse();
|
||||
|
|
Loading…
Reference in a new issue