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:
@ -17,7 +17,7 @@ impl super::MirBuilder {
|
||||
// Unified members: if object class is known and has a synthetic getter for `field`,
|
||||
// rewrite to method call `__get_<field>()`.
|
||||
if let Some(class_name) = self.type_ctx.value_origin_newbox.get(&object_value).cloned() {
|
||||
if let Some(map) = self.property_getters_by_box.get(&class_name) {
|
||||
if let Some(map) = self.comp_ctx.property_getters_by_box.get(&class_name) {
|
||||
if let Some(kind) = map.get(&field) {
|
||||
let mname = match kind {
|
||||
super::PropertyKind::Computed => format!("__get_{}", field),
|
||||
@ -53,7 +53,7 @@ impl super::MirBuilder {
|
||||
|
||||
// Propagate recorded origin class for this field if any (ValueId-scoped)
|
||||
if let Some(class_name) = self
|
||||
.field_origin_class
|
||||
.comp_ctx.field_origin_class
|
||||
.get(&(object_value, field.clone()))
|
||||
.cloned()
|
||||
{
|
||||
@ -61,7 +61,7 @@ impl super::MirBuilder {
|
||||
} else if let Some(base_cls) = self.type_ctx.value_origin_newbox.get(&object_value).cloned() {
|
||||
// Cross-function heuristic: use class-level field origin mapping
|
||||
if let Some(fcls) = self
|
||||
.field_origin_by_box
|
||||
.comp_ctx.field_origin_by_box
|
||||
.get(&(base_cls.clone(), field.clone()))
|
||||
.cloned()
|
||||
{
|
||||
@ -89,7 +89,7 @@ impl super::MirBuilder {
|
||||
{
|
||||
if let Ok(base_id) = self.build_expression(*inner_obj.clone()) {
|
||||
if let Some(cls) = self
|
||||
.field_origin_class
|
||||
.comp_ctx.field_origin_class
|
||||
.get(&(base_id, inner_field))
|
||||
.cloned()
|
||||
{
|
||||
@ -99,7 +99,7 @@ impl super::MirBuilder {
|
||||
}
|
||||
}
|
||||
if let Some(class_name) = inferred_class {
|
||||
if let Some(weak_set) = self.weak_fields_by_box.get(&class_name) {
|
||||
if let Some(weak_set) = self.comp_ctx.weak_fields_by_box.get(&class_name) {
|
||||
if weak_set.contains(&field) {
|
||||
let loaded = self.emit_weak_load(field_val)?;
|
||||
let _ = self.emit_barrier_read(loaded);
|
||||
@ -129,7 +129,7 @@ impl super::MirBuilder {
|
||||
|
||||
// If base is known and field is weak, create WeakRef before store
|
||||
if let Some(class_name) = self.type_ctx.value_origin_newbox.get(&object_value).cloned() {
|
||||
if let Some(weak_set) = self.weak_fields_by_box.get(&class_name) {
|
||||
if let Some(weak_set) = self.comp_ctx.weak_fields_by_box.get(&class_name) {
|
||||
if weak_set.contains(&field) {
|
||||
value_result = self.emit_weak_new(value_result)?;
|
||||
}
|
||||
@ -159,7 +159,7 @@ impl super::MirBuilder {
|
||||
|
||||
// Write barrier if weak field
|
||||
if let Some(class_name) = self.type_ctx.value_origin_newbox.get(&object_value).cloned() {
|
||||
if let Some(weak_set) = self.weak_fields_by_box.get(&class_name) {
|
||||
if let Some(weak_set) = self.comp_ctx.weak_fields_by_box.get(&class_name) {
|
||||
if weak_set.contains(&field) {
|
||||
let _ = self.emit_barrier_write(value_result);
|
||||
}
|
||||
@ -168,11 +168,11 @@ impl super::MirBuilder {
|
||||
|
||||
// Record origin class for this field value if known
|
||||
if let Some(val_cls) = self.type_ctx.value_origin_newbox.get(&value_result).cloned() {
|
||||
self.field_origin_class
|
||||
self.comp_ctx.field_origin_class
|
||||
.insert((object_value, field.clone()), val_cls.clone());
|
||||
// Also record class-level mapping if base object class is known
|
||||
if let Some(base_cls) = self.type_ctx.value_origin_newbox.get(&object_value).cloned() {
|
||||
self.field_origin_by_box
|
||||
self.comp_ctx.field_origin_by_box
|
||||
.insert((base_cls, field.clone()), val_cls);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user