refactor: Extract debug utilities from control_flow.rs (Phase 1)

- Created control_flow/ subdirectory
- Moved trace_varmap() to debug.rs
- All control flow logic now in control_flow/mod.rs
- Zero breaking changes, all functionality preserved
- Tests pass (binary execution verified)
This commit is contained in:
nyash-codex
2025-12-05 20:41:19 +09:00
parent 8fe0babf01
commit 41de2d20e9
2 changed files with 26 additions and 11 deletions

View File

@ -0,0 +1,16 @@
//! Debug utilities for control flow tracing
use super::super::MirBuilder;
impl MirBuilder {
/// Trace variable_map state for debugging
/// Enable with NYASH_TRACE_VARMAP=1
pub(in crate::mir::builder) fn trace_varmap(&self, context: &str) {
if std::env::var("NYASH_TRACE_VARMAP").is_ok() {
let vars: Vec<_> = self.variable_map.iter()
.map(|(k, v)| format!("{}={:?}", k, v))
.collect();
eprintln!("[varmap/{}] {{{}}}", context, vars.join(", "));
}
}
}