mirror of
https://github.com/artegoser/ONLang
synced 2024-12-23 01:23:46 +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`",
|
"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",
|
||||||
{
|
{
|
||||||
|
|
19
src/main.rs
19
src/main.rs
|
@ -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();
|
||||||
|
|
Loading…
Add table
Reference in a new issue