feat(mir): Phase 136 Step 2/7 - CoreContext extraction complete
Extract core ID generation fields from MirBuilder to improve organization: - value_gen: ValueIdGenerator - block_gen: BasicBlockIdGenerator - next_binding_id: u32 (Phase 74) - temp_slot_counter: u32 - debug_join_counter: u32 Implementation: - Created src/mir/builder/core_context.rs (215 lines) - Added core_ctx field to MirBuilder as SSOT - Deprecated legacy fields with backward compat - ID allocation methods use core_ctx and sync legacy fields - Added next_block_id() helper, replaced 30+ block_gen.next() calls Testing: - cargo build --release: SUCCESS (193 warnings expected) - cargo test --release --lib: 1004/1004 PASS (+7 tests) - phase135_trim_mir_verify.sh: PASS - phase132_exit_phi_parity.sh: 3/3 PASS Progress: 2/7 Context extractions complete (TypeContext + CoreContext) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@ -13,12 +13,12 @@ impl super::MirBuilder {
|
||||
let scr_val = self.build_expression_impl(scrutinee)?;
|
||||
|
||||
// Prepare merge and result
|
||||
let merge_block: BasicBlockId = self.block_gen.next();
|
||||
let merge_block: BasicBlockId = self.next_block_id();
|
||||
let result_val = self.next_value_id();
|
||||
let mut phi_inputs: Vec<(BasicBlockId, ValueId)> = Vec::new();
|
||||
|
||||
// Create dispatch block where we start comparing arms
|
||||
let dispatch_block = self.block_gen.next();
|
||||
let dispatch_block = self.next_block_id();
|
||||
// Jump from current block to dispatch (ensure terminator exists)
|
||||
let need_jump = {
|
||||
let cur = self.current_block;
|
||||
@ -39,7 +39,7 @@ impl super::MirBuilder {
|
||||
|
||||
// If there are no arms, fall through to else directly
|
||||
if arms.is_empty() {
|
||||
let else_block = self.block_gen.next();
|
||||
let else_block = self.next_block_id();
|
||||
crate::mir::builder::emission::branch::emit_jump(self, else_block)?;
|
||||
self.start_new_block(else_block)?;
|
||||
let else_val = self.build_expression_impl(else_expr)?;
|
||||
@ -52,15 +52,15 @@ impl super::MirBuilder {
|
||||
}
|
||||
|
||||
// Else block to handle default case
|
||||
let else_block = self.block_gen.next();
|
||||
let else_block = self.next_block_id();
|
||||
|
||||
// Chain dispatch blocks for each arm
|
||||
let mut cur_dispatch = dispatch_block;
|
||||
for (i, (label, arm_expr)) in arms.iter().cloned().enumerate() {
|
||||
let then_block = self.block_gen.next();
|
||||
let then_block = self.next_block_id();
|
||||
// Next dispatch (only for non-last arm)
|
||||
let next_dispatch = if i + 1 < arms.len() {
|
||||
Some(self.block_gen.next())
|
||||
Some(self.next_block_id())
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user