feat(joinir): Phase 231 - ExprLowerer/ScopeManager pilot implementation

Pilot implementation of unified expression lowering for Pattern2 break conditions:

New files:
- scope_manager.rs (280 lines) - ScopeManager trait + Pattern2ScopeManager
- expr_lowerer.rs (455 lines) - ExprLowerer with Condition context support

Features:
- Unified variable lookup across ConditionEnv/LoopBodyLocalEnv/CapturedEnv/CarrierInfo
- Pre-validation of condition AST before lowering
- Fail-safe design with fallback to legacy path
- 8 new unit tests (all pass)

Integration:
- Pattern2 break condition uses ExprLowerer for pre-validation
- Existing proven lowering path preserved
- Zero impact on existing functionality (890/897 tests pass)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
nyash-codex
2025-12-10 22:48:45 +09:00
parent b07329b37f
commit 13a676d406
10 changed files with 1427 additions and 75 deletions

View File

@ -34,6 +34,7 @@ pub mod condition_to_joinir; // Phase 169: JoinIR condition lowering orchestrato
pub mod method_call_lowerer; // Phase 224-B: MethodCall lowering (metadata-driven)
pub(crate) mod condition_var_extractor; // Phase 171-fix: Variable extraction from condition AST
pub mod continue_branch_normalizer; // Phase 33-19: Continue branch normalization for Pattern B
pub mod expr_lowerer; // Phase 231: Unified expression lowering with scope management
pub mod loop_update_analyzer; // Phase 197: Update expression analyzer for carrier semantics
pub mod loop_update_summary; // Phase 170-C-2: Update pattern summary for shape detection
pub(crate) mod exit_args_resolver; // Internal exit argument resolution
@ -52,6 +53,7 @@ pub mod inline_boundary; // Phase 188-Impl-3: JoinIR→Host boundary
pub mod inline_boundary_builder; // Phase 200-2: Builder pattern for JoinInlineBoundary
pub mod join_value_space; // Phase 201: Unified JoinIR ValueId allocation
pub(crate) mod loop_form_intake; // Internal loop form intake
pub mod scope_manager; // Phase 231: Unified variable scope management
pub(crate) mod loop_pattern_router; // Phase 33-12: Loop pattern routing (re-exported)
pub(crate) mod loop_pattern_validator; // Phase 33-23: Loop structure validation
pub(crate) mod loop_patterns; // Phase 188: Pattern-based loop lowering (3 patterns)