Commit Graph

3 Commits

Author SHA1 Message Date
0d6229d5a2 Stabilize joinir tests and env guards 2025-12-27 17:41:30 +09:00
f1ff305c08 refactor(cleanup): Remove unused BindingContext methods
Removed dead code from BindingContext after analysis of actual usage:

**Deleted Methods (3)**:
- contains() - never used
- len() - never used
- is_empty() - never used

**Feature Gate Fix**:
- binding_map(): Added #[cfg(feature = "normalized_dev")]
  - Method only used within normalized_dev feature gates
  - Prevents "never used" warning in standard builds

**Analysis**:
BindingContext is actively used via:
- lookup() - variable name to BindingId resolution
- insert() - variable registration
- remove() - variable removal
- binding_map() - internal map access (normalized_dev only)

Files using binding_ctx:
- vars/lexical_scope.rs (5 usages)
- pattern3_with_if_phi.rs (2 usages)
- pattern4_with_continue.rs (2 usages)
- trim_loop_lowering.rs (2 usages)
- pattern2_inputs_facts_box.rs (1 usage)

**Result**: All BindingContext dead_code warnings eliminated

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-24 04:18:24 +09:00
1adf57ec54 refactor(mir): Extract BindingContext from MirBuilder (Phase 136 follow-up 4/7)
## Summary
Extracted binding management into dedicated BindingContext struct,
completing step 4 of 7 in the Context Box refactoring plan.

## Changes
- NEW: src/mir/builder/binding_context.rs (BindingContext struct + helpers)
- Modified 7 files to use binding_ctx (SSOT pattern with legacy sync)
- Added comprehensive unit tests for BindingContext

## Extracted Fields
- binding_map: BTreeMap<String, BindingId> → binding_ctx.binding_map

## Benefits
- Clear separation: BindingId mapping isolated from MirBuilder
- Better testability: BindingContext can be tested independently
- Consistent pattern: Same SSOT + legacy sync approach as previous steps

## Tests
- cargo test --release --lib: 1008/1008 passed
- phase135_trim_mir_verify.sh: PASS
- Backward compatibility: 100% maintained (deprecated fields synced)

## Progress
Phase 136 Context Extraction: 4/7 complete (57%)
-  Step 1: TypeContext
-  Step 2: CoreContext
-  Step 3: ScopeContext
-  Step 4: BindingContext (this commit)
-  Step 5: VariableContext
-  Step 6: MetadataContext
-  Step 7: RegionContext

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-15 20:40:23 +09:00