chore(joinir): Phase 203-A remove dead code after JoinValueSpace unification

Remove obsolete v1 API and unused imports after Phase 201-202 JoinValueSpace unification.

Changes:
- Remove v1 API build_for_break_condition() (70 lines)
  - Converted 3 unit tests to v2 API (build_for_break_condition_v2)
  - Updated module documentation to reflect v2 as standard
- Remove 2 unused imports (JoinValueSpace, ValueId)
  - inline_boundary_builder.rs: Remove unused JoinValueSpace import
  - loop_with_if_phi_minimal.rs: Remove unused ValueId import
- Document stub function (lower_loop_with_break_to_joinir)
  - Add Phase 203-A documentation clarifying stub status
  - Explain why stub exists and migration options
  - Kept stub as it's called by router (line 148 in loop_pattern_router.rs)

Stats:
- 4 files changed
- 75 net lines removed (117 deletions, 42 insertions)
- All tests passing (821 passed)
- Build clean with no errors

Related:
- Phase 201: JoinValueSpace unified ValueId allocation
- Phase 202: Pattern 2 conversion to v2 API

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
nyash-codex
2025-12-09 19:33:38 +09:00
parent ae741d97b4
commit de9fe3bf85
4 changed files with 42 additions and 117 deletions

View File

@ -86,44 +86,30 @@ pub fn lower_loop_with_break_to_joinir(
_loop_form: &LoopForm,
_lowerer: &mut LoopToJoinLowerer,
) -> Option<JoinInst> {
// Phase 188-Impl-2: Delegate to minimal lowerer
// TODO: Extract LoopScopeShape from loop_form for generic implementation
use crate::mir::join_ir::lowering::loop_scope_shape::LoopScopeShape;
use crate::mir::BasicBlockId;
use std::collections::{BTreeMap, BTreeSet};
// For now, use a placeholder LoopScopeShape
// TODO: Build actual LoopScopeShape from loop_form
let _placeholder_scope = LoopScopeShape {
header: BasicBlockId(0),
body: BasicBlockId(0),
latch: BasicBlockId(0),
exit: BasicBlockId(0),
pinned: BTreeSet::new(),
carriers: BTreeSet::new(),
body_locals: BTreeSet::new(),
exit_live: BTreeSet::new(),
progress_carrier: None,
variable_definitions: BTreeMap::new(),
};
// Generate JoinIR module
// Phase 169: lower_loop_with_break_minimal now requires condition AST and builder
// This test stub is not used by the actual router, so commenting out for now
// let _join_module = lower_loop_with_break_minimal(placeholder_scope, condition, builder)?;
// Phase 188-Impl-2: Pattern 2 is now integrated in control_flow.rs via cf_loop_pattern2_with_break()
// This function (lower_loop_with_break_to_joinir) is currently not used by the router.
// The actual lowering happens directly in control_flow.rs which calls loop_with_break_minimal.
// Phase 203-A: STUB FUNCTION - Called by router but always returns None
//
// TODO: Either:
// 1. Remove this function and rely only on control_flow.rs integration, OR
// 2. Implement JoinModule → JoinInst conversion here (future phase)
// Status: This function is called by loop_pattern_router.rs:148 but is a NO-OP stub.
// The actual Pattern 2 lowering happens via control_flow.rs.
//
// Why this stub exists:
// - Router expects unified interface: lower_*_to_joinir(loop_form, lowerer)
// - Pattern 2 is tightly integrated with control_flow.rs
// - Removing it would require updating router dispatch logic
//
// Current behavior:
// 1. Router calls this function (line 148 in loop_pattern_router.rs)
// 2. Function logs a message and returns None
// 3. Router falls back to control_flow.rs hardcoded Pattern 2 route
//
// Migration options (future):
// - Option 1: Remove stub and update router to call control_flow.rs directly
// - Option 2: Implement JoinModule → JoinInst conversion here
//
// Related code:
// - Router callsite: loop_pattern_router.rs:148
// - Actual implementation: control_flow::cf_loop_pattern2_with_break()
// - Minimal lowerer: loop_with_break_minimal::lower_loop_with_break_minimal()
eprintln!("[loop_patterns] Pattern 2: Lowering delegated to control_flow.rs");
// Temporary: Return None to trigger fallback
// Pattern 2 currently works via hardcoded route in control_flow.rs
eprintln!("[loop_patterns] Pattern 2: Lowering delegated to control_flow.rs (stub)");
None
}