nyash-codex
3127ebb73d
feat(mir): Phase 136 Step 3/7 - ScopeContext extraction
## Summary
Extract scope and control flow management into ScopeContext for better organization.
## Changes
- **New file**: src/mir/builder/scope_context.rs (264 lines)
- Lexical scope stack management
- Control flow stacks (loop/if)
- Function context tracking
- Debug scope helpers
- **Updated**: src/mir/builder.rs
- Add scope_ctx field
- Mark legacy fields as deprecated
- Add sync helpers (sync_scope_ctx_to_legacy, sync_legacy_to_scope_ctx)
- **Updated**: src/mir/builder/vars/lexical_scope.rs
- Use scope_ctx as SSOT
- Sync to legacy fields for backward compat
- **Updated**: src/mir/builder/lifecycle.rs
- Sync current_function via scope_ctx
- **Updated**: src/mir/builder/calls/lowering.rs
- Sync function context in lowering flow
## Extracted Fields (7)
1. lexical_scope_stack - Block-scoped locals
2. loop_header_stack - Loop headers for break/continue
3. loop_exit_stack - Loop exit blocks
4. if_merge_stack - If merge blocks
5. current_function - Currently building function
6. function_param_names - Function parameters (for LoopForm)
7. debug_scope_stack - Debug region identifiers
## Test Results
- ✅ cargo build --release (291 warnings - deprecated usage)
- ✅ cargo test --release --lib - 1005/1009 PASS
- ✅ phase135_trim_mir_verify.sh - PASS
- ⚠️ phase132_exit_phi_parity.sh - Error (pre-existing issue)
## Progress
Phase 136: 3/7 Contexts complete (TypeContext, CoreContext, ScopeContext)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-15 20:28:21 +09:00
..
2025-09-17 10:58:12 +09:00
2025-12-15 20:28:21 +09:00
2025-11-06 15:41:52 +09:00
2025-11-06 15:41:52 +09:00
2025-08-26 01:42:18 +09:00
2025-09-05 13:29:17 +09:00
2025-12-04 14:19:48 +09:00
2025-12-04 14:19:48 +09:00