nyash-codex
7eec4ec0c8
feat(control_tree): Phase 123 if-only compare+return lowering (Normalized, dev-only)
Implements Phase 123 P3: If(cond_ast) minimal lowering with graceful degradation.
**What's Implemented**:
- If node lowering with minimal binary comparison (Variable op Integer)
- Supported operators: ==, !=, <, <=, >, >=
- Generates: Compare + Const + Ret structure
- Graceful degradation: returns Ok(None) for unsupported patterns
**Key Design Decisions**:
1. **Graceful Degradation**: Phase 123 limitations return `Ok(None)` instead of failing
- Allows dev-only mode to coexist with legacy code
- Error messages prefixed with `[phase123/...]` are caught
2. **Fail-Fast with Structured Errors**: All limitations use structured error codes
- Format: `[phase123/category/specific]`
3. **Box-First Principles**:
- `parse_minimal_compare`: Single responsibility parser
- `verify_branch_is_return_literal`: Branch validation box
- `lower_if_node`: If lowering box
**Implementation**:
- Added `lower_if_node`: If lowering with minimal compare
- Added `parse_minimal_compare`: Binary comparison parser
- Added `verify_branch_is_return_literal`: Branch validator
- Updated `lower_if_only_to_normalized` return type: `Result<Option<...>, ...>`
- Updated `test_return_variable_out_of_scope`: Verifies graceful degradation
- Added `test_if_minimal_compare`: Verifies If lowering structure
**Tests**: 8 passed (including graceful degradation test)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 05:50:09 +09:00
..
2025-12-18 04:52:09 +09:00
2025-12-18 05:50:09 +09:00
2025-11-21 06:25:17 +09:00
2025-12-08 23:43:26 +09:00
2025-12-11 20:54:33 +09:00
2025-11-30 04:35:40 +09:00
2025-12-18 03:56:10 +09:00
2025-12-16 07:02:14 +09:00
2025-12-11 20:54:33 +09:00
2025-12-17 21:24:46 +09:00
2025-12-17 16:33:11 +09:00
2025-11-30 14:30:28 +09:00
2025-12-11 20:54:33 +09:00
2025-12-11 20:54:33 +09:00
2025-12-11 20:54:33 +09:00
2025-12-16 07:02:14 +09:00
2025-11-30 09:38:28 +09:00
2025-12-16 07:02:14 +09:00
2025-11-24 15:02:51 +09:00
2025-11-21 06:25:17 +09:00
2025-12-11 17:16:10 +09:00
2025-12-13 05:34:56 +09:00
2025-12-17 18:29:27 +09:00
2025-12-07 23:45:55 +09:00
2025-12-03 13:59:06 +09:00
2025-12-03 13:59:06 +09:00
2025-11-21 06:25:17 +09:00
2025-12-05 17:22:14 +09:00
2025-12-15 22:03:34 +09:00
2025-09-17 07:43:07 +09:00
2025-11-30 04:35:40 +09:00
2025-12-05 15:45:42 +09:00
2025-12-16 07:02:14 +09:00
2025-12-16 03:33:56 +09:00
2025-11-24 14:17:02 +09:00
2025-12-18 00:22:21 +09:00
2025-11-24 14:17:02 +09:00
2025-09-17 07:43:07 +09:00
2025-12-03 13:59:06 +09:00
2025-11-30 04:35:40 +09:00
2025-12-05 19:39:54 +09:00
2025-11-24 15:02:51 +09:00
2025-09-24 09:30:42 +09:00
2025-11-24 15:02:51 +09:00
2025-11-21 06:25:17 +09:00
2025-11-17 09:45:03 +09:00
2025-11-24 15:02:51 +09:00
2025-11-21 06:25:17 +09:00
2025-12-03 13:59:06 +09:00