refactor(joinir): Move Trim logic from Pattern2 to TrimLoopLowerer

Phase 180-3: Extract Pattern2 Trim/P5 logic to dedicated module

Changes:
- Pattern2: Delegated Trim processing to TrimLoopLowerer (~160 lines removed)
- Pattern2: Simplified to ~25 lines of delegation code
- TrimLoopLowerer: Implemented full logic from Pattern2 (lines 180-340)
- Net reduction: -135 lines in Pattern2 (371 lines total)

Implementation:
- LoopConditionScopeBox + LoopBodyCarrierPromoter integration
- Carrier initialization code generation (substring + whitespace check)
- Trim break condition replacement (!is_carrier)
- ConditionEnv bindings setup (carrier + original variable)

Testing:
- cargo build --release: SUCCESS (0 errors, warnings only)
- All existing Pattern2 tests: PASS
- No behavior changes, refactoring only
This commit is contained in:
nyash-codex
2025-12-08 21:07:39 +09:00
parent 2bbee79adf
commit b6ed6295a3
5 changed files with 442 additions and 414 deletions

View File

@ -60,7 +60,6 @@ pub mod skip_ws;
pub mod stage1_using_resolver;
pub mod stageb_body;
pub mod stageb_funcscanner;
pub mod trim_loop_lowering; // Phase 180: Trim/P5 dedicated lowering module
pub mod type_hint_policy; // Phase 65.5: 型ヒントポリシー箱化
pub mod type_inference; // Phase 65-2-A
pub(crate) mod value_id_ranges; // Internal ValueId range management