refactor(mir): Remove CompilationContext legacy fields (Phase 2-7/7) 🎉

Phase 2 完全完了!全 7 Context のレガシーフィールドを完全削除。

## Changes
- Migrated all access sites to comp_ctx.* (15 fields)
- Removed 15 deprecated fields:
  * compilation_context
  * current_static_box
  * user_defined_boxes
  * reserved_value_ids
  * fn_body_ast
  * weak_fields_by_box
  * property_getters_by_box
  * field_origin_class
  * field_origin_by_box
  * static_method_index
  * method_tail_index
  * method_tail_index_source_len
  * type_registry
  * current_slot_registry
  * plugin_method_sigs
- Removed initialization code (15 field inits)

## Phase 2 完了!🎉
- builder.rs: 1222 → 1127 lines (-95 lines net)
- Deprecation warnings: 86 → 0 (完全排除)
- 全 36 deprecated fields 削除完了
- 全 14 sync helpers 削除完了
- 7 Context 完全SSOT化

## Tests
- cargo build --release: SUCCESS
- cargo test --release --lib: 1033/1033 PASS 
- Deprecation warnings: 0 

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

Phase 136 Context Box化: 完全完了!

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
nyash-codex
2025-12-16 04:07:17 +09:00
parent 9170f0a85d
commit 990d00393e
18 changed files with 88 additions and 183 deletions

View File

@ -340,7 +340,7 @@ impl super::MirBuilder {
}
self.declare_local_in_current_scope(var_name, var_id)?;
// SlotRegistry にもローカル変数スロットを登録しておくよ(観測専用)
if let Some(reg) = self.current_slot_registry.as_mut() {
if let Some(reg) = self.comp_ctx.current_slot_registry.as_mut() {
let ty = self.type_ctx.value_types.get(&var_id).cloned();
reg.ensure_slot(&var_name, ty);
}
@ -430,7 +430,7 @@ impl super::MirBuilder {
self.type_ctx.value_types
.insert(future_id, MirType::Future(Box::new(MirType::Unknown)));
self.variable_ctx.variable_map.insert(variable.clone(), future_id);
if let Some(reg) = self.current_slot_registry.as_mut() {
if let Some(reg) = self.comp_ctx.current_slot_registry.as_mut() {
reg.ensure_slot(&variable, None);
}
return Ok(future_id);
@ -449,7 +449,7 @@ impl super::MirBuilder {
self.type_ctx.value_types
.insert(future_id, MirType::Future(Box::new(inner)));
self.variable_ctx.variable_map.insert(variable.clone(), future_id);
if let Some(reg) = self.current_slot_registry.as_mut() {
if let Some(reg) = self.comp_ctx.current_slot_registry.as_mut() {
reg.ensure_slot(&variable, None);
}
Ok(future_id)
@ -481,14 +481,14 @@ impl super::MirBuilder {
if let Some(id) = self.variable_ctx.variable_map.get("me").cloned() {
return Ok(id);
}
let me_tag = if let Some(ref cls) = self.current_static_box {
let me_tag = if let Some(ref cls) = self.comp_ctx.current_static_box {
cls.clone()
} else {
"__me__".to_string()
};
let me_value = crate::mir::builder::emission::constant::emit_string(self, me_tag);
self.variable_ctx.variable_map.insert("me".to_string(), me_value);
if let Some(reg) = self.current_slot_registry.as_mut() {
if let Some(reg) = self.comp_ctx.current_slot_registry.as_mut() {
reg.ensure_slot("me", None);
}
// P0: Known 化 — 分かる範囲で me の起源クラスを付与(挙動不変)。