Files
hakorune/src/mir/builder/control_flow/debug.rs
nyash-codex 9170f0a85d refactor(mir): Remove VariableContext legacy fields (Phase 2-6/7)
完全移行→削除の安全順序(Option C)に従い、VariableContext の
deprecated フィールドと sync helpers を完全削除。

## Changes
- Migrated all 66+ access sites to variable_ctx.variable_map
- Removed 1 deprecated field (variable_map) from MirBuilder
- Removed 2 sync helpers (sync_variable_ctx_to_legacy, sync_legacy_to_variable_ctx)
- Fixed BoxCompilationContext.variable_map references (kept as-is, different scope)
- Fixed ExitBindingBuilder.variable_map references (kept as-is, local field)
- Updated observer.rs to use variable_map() accessor method

## JoinIR Integration Verified
- CarrierInfo::from_variable_map() works correctly
- ExitLine contract maintained (Phase 132-135)
- NYASH_TRACE_VARMAP debug support preserved
- Pattern 1-5 lowering all functional

## Tests
- cargo test --release --lib: 1033 passed, 0 failed
- phase135_trim_mir_verify.sh: PASS (MIR SSA/ValueId OK)
- cargo build --release: SUCCESS
- Deprecation warnings: reduced (86 remaining, from other contexts)

## Statistics
- 27 files changed
- 146 insertions(+), 174 deletions(-)
- Net: -28 lines

Phase 2 Progress: 6/7 contexts complete (86%)
-  MetadataContext
-  CoreContext
-  TypeContext
-  ScopeContext
-  BindingContext
-  VariableContext (this commit)
-  CompilationContext (Phase 2-7 next)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-16 03:48:44 +09:00

31 lines
1.1 KiB
Rust

//! Debug utilities for control flow tracing.
//!
//! This module provides diagnostic tools for tracing and debugging
//! control flow behavior during MIR construction.
//!
//! # Phase 195: Unified Tracing
//!
//! All JoinIR tracing now goes through the JoinLoopTrace module.
//! See `joinir/trace.rs` for the unified tracing interface.
//!
//! # Environment Variables
//!
//! - `NYASH_TRACE_VARMAP=1` - Enable variable map tracing
//! - `NYASH_JOINIR_DEBUG=1` - Enable general JoinIR debug output
//! - `NYASH_OPTION_C_DEBUG=1` - Enable PHI-related debug
//! - `NYASH_JOINIR_MAINLINE_DEBUG=1` - Enable mainline routing debug
//! - `NYASH_LOOPFORM_DEBUG=1` - Enable LoopForm debug
use super::super::MirBuilder;
impl MirBuilder {
/// Trace variable_map state for debugging
///
/// Phase 195: Delegates to JoinLoopTrace for unified tracing.
/// Enable with NYASH_TRACE_VARMAP=1
#[allow(dead_code)]
pub(in crate::mir::builder) fn trace_varmap(&self, context: &str) {
super::joinir::trace::trace().varmap(context, &self.variable_ctx.variable_map);
}
}