feat(joinir): Phase 200-A ConditionEnv extension infrastructure

Added type and skeleton infrastructure for function-scoped variable
capture, preparing for Phase 200-B integration with ConditionEnv.

New Types:
- CapturedVar: { name, host_id, is_immutable }
- CapturedEnv: Collection of captured variables
- ParamRole: { LoopParam, Condition, Carrier, ExprResult }

New Functions (Skeletons):
- analyze_captured_vars(): Detects function-scoped "constants"
- build_with_captures(): ConditionEnvBuilder v2 entry point
- add_param_with_role(): Role-based parameter routing

New File:
- src/mir/loop_pattern_detection/function_scope_capture.rs

Design Principles:
- Infra only: Types and skeletons, no behavior changes
- Existing behavior maintained: All current loops work identically
- Box-first: New responsibilities in new file
- Documentation: Future implementation plans in code comments

Test Results:
- 6 new unit tests (function_scope_capture: 3, param_role: 3)
- All 804 existing tests PASS (0 regressions)

Next: Phase 200-B (actual capture detection and integration)

🤖 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-09 16:19:08 +09:00
parent f47fa9a7a8
commit 3a9b44c4e2
7 changed files with 914 additions and 1 deletions

View File

@ -780,3 +780,6 @@ pub use trim_loop_helper::TrimLoopHelper;
// Phase 33-23: Break Condition Analysis (Stage 2, Issue 6)
pub mod break_condition_analyzer;
// Phase 200-A: Function Scope Capture Infrastructure
pub mod function_scope_capture;