feat(joinir): Phase 191 body-local init integration into Pattern2
- Integrated LoopBodyLocalInitLowerer into Pattern2 lowering - Fixed ValueId double-allocation issue (delegate to InitLowerer) - Added body_ast parameter to lower_loop_with_break_minimal() - Fixed json_program_loop.rs test for body-local scope - New test: phase191_body_local_atoi.hako (expected: 123) Supported init expressions: - Integer literals, variable references, binary operations 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@ -154,16 +154,13 @@ impl MirBuilder {
|
||||
id
|
||||
};
|
||||
|
||||
// Phase 185-2: Collect body-local variables with safe ValueId allocation
|
||||
// Phase 191: Create empty body-local environment
|
||||
// LoopBodyLocalInitLowerer will populate it during init lowering
|
||||
use crate::mir::join_ir::lowering::loop_body_local_env::LoopBodyLocalEnv;
|
||||
let body_locals = collect_body_local_variables(_body, &mut alloc_body_local_value);
|
||||
let body_local_env = LoopBodyLocalEnv::from_locals(body_locals);
|
||||
let mut body_local_env = LoopBodyLocalEnv::new();
|
||||
|
||||
eprintln!("[pattern2/body-local] Phase 185-2: Collected {} body-local variables (offset={})",
|
||||
body_local_env.len(), body_local_start_offset);
|
||||
for (name, vid) in body_local_env.iter() {
|
||||
eprintln!(" {} → {:?}", name, vid);
|
||||
}
|
||||
eprintln!("[pattern2/body-local] Phase 191: Created empty body-local environment (offset={})",
|
||||
body_local_start_offset);
|
||||
|
||||
// Create allocator for other JoinIR-local ValueIds (Trim pattern, etc.)
|
||||
// Continues from where body_local_counter left off
|
||||
@ -307,7 +304,8 @@ impl MirBuilder {
|
||||
&env,
|
||||
&carrier_info,
|
||||
&carrier_updates,
|
||||
Some(&body_local_env), // Phase 185-2: Pass body-local environment
|
||||
_body, // Phase 191: Pass body AST for init lowering
|
||||
Some(&mut body_local_env), // Phase 191: Pass mutable body-local environment
|
||||
) {
|
||||
Ok((module, meta)) => (module, meta),
|
||||
Err(e) => {
|
||||
|
||||
Reference in New Issue
Block a user