feat(joinir): Phase 77 - BindingId expansion implementation (dev-only)

Phase 77 implements promoted_bindings population in DigitPos/Trim promoters
and deprecates legacy name-based resolution paths.

Changes:
- DigitPosPromoter: Added binding_map field and record_promoted_binding() calls
- TrimLoopHelper: Added binding_map field for ch → is_ch_match tracking
- Pattern2/4: Wired binding_map from builder.binding_map to promoters
- Legacy deprecation: Added #[deprecated] to resolve_promoted_join_id()
- Dual-path design: BindingId priority + name fallback maintained

Files modified (8):
- pattern2_with_break.rs, pattern4_with_continue.rs: binding_map wiring
- trim_loop_lowering.rs: Trim promoter integration
- carrier_info.rs: Deprecation warnings
- scope_manager.rs: Deprecated fallback paths
- loop_body_carrier_promoter.rs: Trim binding_map support
- loop_body_cond_promoter.rs: Orchestrator updates
- loop_body_digitpos_promoter.rs: DigitPos binding_map support

Tests: 958/958 PASS (zero regressions)
Design: Type-safe BindingId mapping replaces string-based promoted variable resolution

Phase 78+ will delete deprecated code (~50 lines) and make binding_map required.

🤖 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-13 05:58:57 +09:00
parent 65ecd75529
commit 72173c1ac8
8 changed files with 153 additions and 2 deletions

View File

@ -290,6 +290,13 @@ impl<'a> ScopeManager for Pattern2ScopeManager<'a> {
}
// Step 3: Fallback to legacy name-based lookup (Phase 75 fallback path)
// Phase 77: DEPRECATED - Will be removed in Phase 78+
#[cfg(feature = "normalized_dev")]
eprintln!(
"[phase77/fallback] WARNING: BindingId({}) for '{}' not resolved, falling back to name-based lookup (DEPRECATED)",
bid.0, name
);
#[cfg(not(feature = "normalized_dev"))]
if std::env::var("NYASH_JOINIR_DEBUG").is_ok() {
eprintln!(
"[phase76/fallback] BindingId({}) miss, falling back to name '{}' lookup",
@ -298,7 +305,8 @@ impl<'a> ScopeManager for Pattern2ScopeManager<'a> {
}
}
// Step 4: Legacy name-based lookup (Phase 75 behavior, will be removed in Phase 77)
// Step 4: Legacy name-based lookup (Phase 75 behavior)
// Phase 77: DEPRECATED - Will be removed in Phase 78+ after all call sites use BindingId
self.lookup(name)
}
}