Files @ ed4fe8216eb0
Branch filter:

Location: CSY/reowolf/src/macros.rs

ed4fe8216eb0 856 B application/rls-services+xml Show Annotation Show as Raw Download as Raw
MH
Fix binding- and assignment-expression related typing issues.

Simpler solutions are better, so the typechecker is back to normal.
Instead we simply make sure that assignment expression is never
nested under another expression, and binding expressions may only
be nested under LogicalAnd-expressions. If only I knew why I thought
type shenanigans were a good idea in the first place...
macro_rules! enabled_debug_print {
    (false, $name:literal, $format:literal) => {};
    (false, $name:literal, $format:literal, $($args:expr),*) => {};
    (true, $name:literal, $format:literal) => {
        println!("[{}] {}", $name, $format)
    };
    (true, $name:literal, $format:literal, $($args:expr),*) => {
        println!("[{}] {}", $name, format!($format, $($args),*))
    };
}

/*
Change the definition of these macros to control the logging level statically
*/

macro_rules! log {
    (@ENDPT, $logger:expr, $($arg:tt)*) => {{
        // if let Some(w) = $logger.line_writer() {
        //     let _ = writeln!(w, $($arg)*);
        // }
    }};
    ($logger:expr, $($arg:tt)*) => {{
        #[cfg(not(feature = "no_logging"))]
        if let Some(w) = $logger.line_writer() {
            let _ = writeln!(w, $($arg)*);
        }
    }};
}