Fix debug flags for release mode

This commit is contained in:
Ayaz Hafiz 2022-11-16 12:34:57 -06:00
parent a8b55dc794
commit 76a3e92088
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
2 changed files with 14 additions and 8 deletions

View file

@ -35,21 +35,27 @@
#[macro_export]
macro_rules! dbg_set {
($flag:path) => {
if !cfg!(debug_assertions) {
($flag:path) => {{
#[cfg(not(debug_assertions))]
{
false
} else {
}
#[cfg(debug_assertions)]
{
let flag = std::env::var($flag);
!flag.is_err() && flag.as_deref() != Ok("0")
}
};
}};
}
#[macro_export]
macro_rules! dbg_do {
($flag:path, $expr:expr) => {
if $crate::dbg_set!($flag) {
$expr
#[cfg(debug_assertions)]
{
if $crate::dbg_set!($flag) {
$expr
}
}
};
}

View file

@ -1,8 +1,8 @@
use bitflags::bitflags;
use roc_collections::{VecMap, VecSet};
use roc_debug_flags::{dbg_do, dbg_set, ROC_VERIFY_OCCURS_RECURSION};
use roc_debug_flags::{dbg_do, dbg_set};
#[cfg(debug_assertions)]
use roc_debug_flags::{ROC_PRINT_MISMATCHES, ROC_PRINT_UNIFICATIONS};
use roc_debug_flags::{ROC_PRINT_MISMATCHES, ROC_PRINT_UNIFICATIONS, ROC_VERIFY_OCCURS_RECURSION};
use roc_error_macros::internal_error;
use roc_module::ident::{Lowercase, TagName};
use roc_module::symbol::{ModuleId, Symbol};