feat(joinir): Phase 80-B/C/D - Pattern3/4 BindingId wiring + E2E tests (dev-only)
Task 80-B (P1): Pattern3 (if-sum) BindingId registration - pattern3_with_if_phi.rs: Added BindingId→ValueId registration - Loop var + condition bindings registration (lines 131-159) - Debug logs: [phase80/p3] tags - Follows Pattern2 template structure Task 80-C (P2): Pattern4 (continue) BindingId registration - pattern4_with_continue.rs: Pass binding_map to lowerer (lines 341-352) - loop_with_continue_minimal.rs: Added BindingId→ValueId registration (lines 206-230) - Loop var + condition bindings registration - Debug logs: [phase80/p4] tags - Follows Pattern2 template structure Task 80-D (P3): E2E tests for BindingId lookup - tests/normalized_joinir_min.rs: Added 2 new tests (lines 2182-2222) - test_phase80_p3_bindingid_lookup_works(): Pattern3 verification - test_phase80_p4_bindingid_lookup_works(): Pattern4 verification - Manual fallback detection via NYASH_JOINIR_DEBUG=1 Task P4: Cleanup - Fixed unused variable warnings (loop_var_join_id → _loop_var_join_id) - Fixed unnecessary mut warning (cargo fix auto-applied) - pattern2_with_break.rs: Clean up pre-existing unused warning Result: BindingId operational across Pattern2/3/4 Tests: 970/970 PASS (baseline, E2E tests in normalized_dev feature) Design: dev-only, dual-path maintained, zero production impact Phase 74-80 complete: BindingId migration fully operational across all patterns 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@ -104,7 +104,7 @@ fn prepare_pattern2_inputs(
|
||||
|
||||
// Value space + condition env
|
||||
let mut join_value_space = JoinValueSpace::new();
|
||||
let (mut env, mut condition_bindings, loop_var_join_id) =
|
||||
let (mut env, mut condition_bindings, _loop_var_join_id) =
|
||||
ConditionEnvBuilder::build_for_break_condition_v2(
|
||||
condition,
|
||||
&loop_var_name,
|
||||
@ -116,13 +116,13 @@ fn prepare_pattern2_inputs(
|
||||
// Phase 79-2: Register loop variable BindingId (dev-only)
|
||||
#[cfg(feature = "normalized_dev")]
|
||||
if let Some(loop_var_bid) = builder.binding_map.get(&loop_var_name).copied() {
|
||||
env.register_loop_var_binding(loop_var_bid, loop_var_join_id);
|
||||
env.register_loop_var_binding(loop_var_bid, _loop_var_join_id);
|
||||
log_pattern2(
|
||||
verbose,
|
||||
"phase79",
|
||||
format!(
|
||||
"Registered loop var BindingId: '{}' BindingId({}) → ValueId({})",
|
||||
loop_var_name, loop_var_bid.0, loop_var_join_id.0
|
||||
loop_var_name, loop_var_bid.0, _loop_var_join_id.0
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@ -128,6 +128,36 @@ impl MirBuilder {
|
||||
&mut join_value_space,
|
||||
)?;
|
||||
|
||||
// Phase 80-B (P1): Register BindingIds for condition variables (dev-only)
|
||||
#[cfg(feature = "normalized_dev")]
|
||||
{
|
||||
// Register loop variable BindingId
|
||||
if let Some(bid) = self.binding_map.get(&loop_var_name) {
|
||||
cond_env.register_loop_var_binding(*bid, _loop_var_join_id);
|
||||
if debug {
|
||||
eprintln!(
|
||||
"[phase80/p3] Registered loop var '{}' BindingId({}) -> ValueId({})",
|
||||
loop_var_name, bid.0, _loop_var_join_id.0
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Register condition binding BindingIds
|
||||
// These are variables from the condition expression (e.g., "len" in "i < len")
|
||||
// May include ConditionOnly carriers if they appear in the condition
|
||||
for binding in &condition_bindings {
|
||||
if let Some(bid) = self.binding_map.get(&binding.name) {
|
||||
cond_env.register_condition_binding(*bid, binding.join_value);
|
||||
if debug {
|
||||
eprintln!(
|
||||
"[phase80/p3] Registered condition binding '{}' BindingId({}) -> ValueId({})",
|
||||
binding.name, bid.0, binding.join_value.0
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
trace::trace().debug(
|
||||
"pattern3/if-sum",
|
||||
&format!("ConditionEnv bindings = {}", condition_bindings.len()),
|
||||
|
||||
@ -338,6 +338,9 @@ fn lower_pattern4_joinir(
|
||||
|
||||
let mut join_value_space = JoinValueSpace::new();
|
||||
|
||||
#[cfg(feature = "normalized_dev")]
|
||||
let binding_map_clone = builder.binding_map.clone();
|
||||
|
||||
let (join_module, exit_meta) = match lower_loop_with_continue_minimal(
|
||||
prepared.loop_scope.clone(),
|
||||
condition,
|
||||
@ -345,6 +348,8 @@ fn lower_pattern4_joinir(
|
||||
&prepared.carrier_info,
|
||||
&prepared.carrier_updates,
|
||||
&mut join_value_space,
|
||||
#[cfg(feature = "normalized_dev")]
|
||||
Some(&binding_map_clone),
|
||||
) {
|
||||
Ok(result) => result,
|
||||
Err(e) => {
|
||||
|
||||
Reference in New Issue
Block a user