fix: compilation of the panic hook only on release

This commit is contained in:
Artemy 2022-08-15 17:23:28 +03:00
parent 1a693e38dd
commit 89f9b31c2b
2 changed files with 12 additions and 10 deletions

View file

@ -290,9 +290,10 @@
}, },
}, },
"fn sum(first, second){ return first+second};",
"Run function `sum`", "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", "\nInput a var",
{ {

View file

@ -15,15 +15,16 @@ mod interpreter;
use interpreter::Interpreter; use interpreter::Interpreter;
fn main() { fn main() {
// std::panic::set_hook(Box::new(|info| { #[cfg(not(debug_assertions))]
// eprint!( std::panic::set_hook(Box::new(|info| {
// "{msg}", eprint!(
// msg = match info.payload().downcast_ref::<String>() { "{msg}",
// None => "Program panicked without a message!", msg = match info.payload().downcast_ref::<String>() {
// Some(x) => x, None => "Program panicked without a message!",
// } Some(x) => x,
// ); }
// })); );
}));
let start = Instant::now(); let start = Instant::now();
let args = Args::parse(); let args = Args::parse();