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:
@ -207,7 +207,7 @@ impl super::MirBuilder {
|
||||
// Generic static box: lower all static methods into standalone MIR functions (BoxName.method/N)
|
||||
// Note: Metadata clearing is now handled by BoxCompilationContext (箱理論)
|
||||
// See lifecycle.rs for context creation and builder_calls.rs for context swap
|
||||
self.user_defined_boxes.insert(name.clone());
|
||||
self.comp_ctx.user_defined_boxes.insert(name.clone());
|
||||
for (method_name, method_ast) in methods.clone() {
|
||||
if let ASTNode::FunctionDeclaration { params, body, .. } = method_ast {
|
||||
let func_name = format!(
|
||||
@ -222,7 +222,7 @@ impl super::MirBuilder {
|
||||
body.clone(),
|
||||
)?;
|
||||
// Index static method for fallback resolution of bare calls
|
||||
self.static_method_index
|
||||
self.comp_ctx.static_method_index
|
||||
.entry(method_name.clone())
|
||||
.or_insert_with(Vec::new)
|
||||
.push((name.clone(), params.len()));
|
||||
@ -234,7 +234,7 @@ impl super::MirBuilder {
|
||||
}
|
||||
} else {
|
||||
// Instance box: register type and lower instance methods/ctors as functions
|
||||
self.user_defined_boxes.insert(name.clone());
|
||||
self.comp_ctx.user_defined_boxes.insert(name.clone());
|
||||
self.build_box_declaration(
|
||||
name.clone(),
|
||||
methods.clone(),
|
||||
@ -311,9 +311,9 @@ impl super::MirBuilder {
|
||||
self.type_ctx.value_types
|
||||
.insert(arr_id, super::MirType::Box("ArrayBox".to_string()));
|
||||
// TypeRegistry + trace for deterministic debug
|
||||
self.type_registry
|
||||
self.comp_ctx.type_registry
|
||||
.record_newbox(arr_id, "ArrayBox".to_string());
|
||||
self.type_registry
|
||||
self.comp_ctx.type_registry
|
||||
.record_type(arr_id, super::MirType::Box("ArrayBox".to_string()));
|
||||
type_trace::origin("newbox:ArrayLiteral", arr_id, "ArrayBox");
|
||||
type_trace::ty(
|
||||
@ -354,9 +354,9 @@ impl super::MirBuilder {
|
||||
.insert(map_id, "MapBox".to_string());
|
||||
self.type_ctx.value_types
|
||||
.insert(map_id, super::MirType::Box("MapBox".to_string()));
|
||||
self.type_registry
|
||||
self.comp_ctx.type_registry
|
||||
.record_newbox(map_id, "MapBox".to_string());
|
||||
self.type_registry
|
||||
self.comp_ctx.type_registry
|
||||
.record_type(map_id, super::MirType::Box("MapBox".to_string()));
|
||||
type_trace::origin("newbox:MapLiteral", map_id, "MapBox");
|
||||
type_trace::ty(
|
||||
|
||||
Reference in New Issue
Block a user