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>
This commit is contained in:
@ -64,7 +64,7 @@ impl MirBuilder {
|
||||
0 => {}
|
||||
1 => {
|
||||
let (_pred, v) = inputs[0];
|
||||
self.variable_map.insert(pin_name.clone(), v);
|
||||
self.variable_ctx.variable_map.insert(pin_name.clone(), v);
|
||||
}
|
||||
_ => {
|
||||
if let Some(func) = self.scope_ctx.current_function.as_mut() {
|
||||
@ -94,7 +94,7 @@ impl MirBuilder {
|
||||
type_hint: None, // Phase 63-6: Legacy path, no type hint
|
||||
})?;
|
||||
}
|
||||
self.variable_map.insert(pin_name.clone(), merged);
|
||||
self.variable_ctx.variable_map.insert(pin_name.clone(), merged);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -164,8 +164,8 @@ impl MirBuilder {
|
||||
0 => {}
|
||||
1 => {
|
||||
// Direct bind (no PHI needed)
|
||||
self.variable_map = pre_if_var_map.clone();
|
||||
self.variable_map.insert(var_name, inputs[0].1);
|
||||
self.variable_ctx.variable_map = pre_if_var_map.clone();
|
||||
self.variable_ctx.variable_map.insert(var_name, inputs[0].1);
|
||||
return Ok(inputs[0].1);
|
||||
}
|
||||
_ => {
|
||||
@ -181,8 +181,8 @@ impl MirBuilder {
|
||||
self.insert_phi_with_dst(result_val, inputs)?;
|
||||
}
|
||||
}
|
||||
self.variable_map = pre_if_var_map.clone();
|
||||
self.variable_map.insert(var_name, result_val);
|
||||
self.variable_ctx.variable_map = pre_if_var_map.clone();
|
||||
self.variable_ctx.variable_map.insert(var_name, result_val);
|
||||
} else {
|
||||
// No variable assignment pattern detected – just emit Phi for expression result
|
||||
let mut inputs: Vec<(BasicBlockId, ValueId)> = Vec::new();
|
||||
@ -215,7 +215,7 @@ impl MirBuilder {
|
||||
}
|
||||
}
|
||||
// Merge variable map conservatively to pre-if snapshot (no new bindings)
|
||||
self.variable_map = pre_if_var_map.clone();
|
||||
self.variable_ctx.variable_map = pre_if_var_map.clone();
|
||||
}
|
||||
|
||||
Ok(result_val)
|
||||
|
||||
Reference in New Issue
Block a user