feat(joinir): Phase 50 Loop Frontend Binding layer

Phase 50 implements the Loop Frontend Binding layer that maps
actual loop variables to JoinIR Frontend's expected names (i, acc, n).

## Changes

- Add loop_frontend_binding.rs module with:
  - LoopFrontendBinding struct for variable mapping
  - for_print_tokens() and for_array_filter() factory methods
  - generate_local_declarations() for JSON v0 format
  - rename_body_variables() for out → acc renaming

- Integrate binding with cf_loop_joinir_impl:
  - Create binding based on function name
  - Inject i/acc/n Local declarations into JSON v0
  - Use correct JoinIR Frontend type names (Int/Var/Method)

## Limitations Found

JoinIR Frontend doesn't support:
- Field access (me.tokens) - blocks print_tokens
- NewBox (new ArrayBox()) - blocks array_filter

These will be addressed in Phase 51.

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
nyash-codex
2025-11-28 20:59:54 +09:00
parent fb1b3132dd
commit 3dc691d39f
4 changed files with 394 additions and 5 deletions

View File

@ -31,6 +31,7 @@ mod exprs_qmark; // ?-propagate
mod fields; // field access/assignment lowering split
mod if_form;
mod lifecycle;
mod loop_frontend_binding; // Phase 50: Loop Frontend Binding (JoinIR variable mapping)
pub(crate) mod loops;
mod ops;
mod phi;