refactor(joinir): Phase 183-2 Consolidate CarrierInfo initialization
Makes CarrierInfo::from_variable_map() the primary initialization method. Common pattern initializer now delegates to this centralized logic. ## Changes 1. **Primary Method: CarrierInfo::from_variable_map()**: - Now the single source of truth for CarrierInfo construction - Used by both MIR and JoinIR contexts - Documented as primary initialization method (Phase 183-2) 2. **CommonPatternInitializer Refactoring**: - Converted to thin wrapper around `CarrierInfo::from_variable_map()` - Delegates carrier collection to primary method - Only adds pattern-specific exclusion filtering - Reduced code duplication (~30 lines removed) 3. **Documentation Updates**: - `carrier_info.rs`: Added Phase 183-2 section explaining primary role - `common_init.rs`: Documented delegation strategy - Clear separation of concerns between modules 4. **Removed Duplicate Logic**: - Eliminated manual carrier collection in `common_init.rs` - Removed `CarrierVar` import (no longer directly constructed) - Unified sorting and validation in one place ## Benefits - **Single source of truth**: CarrierInfo construction logic in one module - **Consistency**: Same initialization algorithm across MIR/JoinIR - **Maintainability**: Changes to carrier logic only needed once - **Testability**: Primary logic tested in carrier_info module ## Testing ✅ All carrier_info tests pass (7 tests) ✅ All pattern tests pass (124 tests) ✅ No behavioral changes 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@ -5,6 +5,15 @@
|
||||
//! without hardcoded variable names or ValueIds.
|
||||
//!
|
||||
//! Phase 193-2: Enhanced builder methods for flexible construction
|
||||
//!
|
||||
//! # Phase 183-2: Primary CarrierInfo Construction
|
||||
//!
|
||||
//! This module is the single source of truth for CarrierInfo initialization.
|
||||
//! Both MIR and JoinIR contexts use `CarrierInfo::from_variable_map()` as the
|
||||
//! primary construction method.
|
||||
//!
|
||||
//! - MIR context: `common_init.rs` delegates to this module
|
||||
//! - JoinIR context: Uses `from_variable_map()` directly
|
||||
|
||||
use crate::mir::ValueId;
|
||||
use std::collections::HashMap;
|
||||
|
||||
Reference in New Issue
Block a user