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

@ -44,7 +44,7 @@ pub(crate) fn try_known_rewrite(
return None;
}
// Only user-defined boxes (plugin/core boxesは対象外)
if !builder.user_defined_boxes.contains(cls) {
if !builder.comp_ctx.user_defined_boxes.contains(cls) {
return None;
}
// Policy gates従来互換
@ -110,7 +110,7 @@ pub(crate) fn try_known_rewrite_to_dst(
if builder.type_ctx.value_origin_newbox.get(&object_value).is_none() {
return None;
}
if !builder.user_defined_boxes.contains(cls) {
if !builder.comp_ctx.user_defined_boxes.contains(cls) {
return None;
}
let allow_userbox_rewrite =
@ -181,7 +181,7 @@ pub(crate) fn try_unique_suffix_rewrite(
let fname = cands.remove(0);
// 🎯 Phase 21.7++ Phase 3: StaticMethodId SSOT 実装
let id = crate::mir::naming::StaticMethodId::parse(&fname)?;
if !builder.user_defined_boxes.contains(&id.box_name) {
if !builder.comp_ctx.user_defined_boxes.contains(&id.box_name) {
return None;
}
// unified
@ -232,7 +232,7 @@ pub(crate) fn try_unique_suffix_rewrite_to_dst(
let fname = cands.remove(0);
// 🎯 Phase 21.7++ Phase 3: StaticMethodId SSOT 実装
let id = crate::mir::naming::StaticMethodId::parse(&fname)?;
if !builder.user_defined_boxes.contains(&id.box_name) {
if !builder.comp_ctx.user_defined_boxes.contains(&id.box_name) {
return None;
}
let _name_const = match crate::mir::builder::name_const::make_name_const_result(builder, &fname)