refactor: Quick Win cleanup - 102 lines deleted, zero regressions
Completed three high-efficiency refactoring tasks: ## Task 1: Pattern1Context deletion (40 lines) - Removed deprecated Pattern1Context struct from simple_while_minimal.rs - Removed context parameter from lowering pipeline - Simplified API surface (one less unused type) - Files: simple_while_minimal.rs, pattern1_minimal.rs, loop_to_join.rs ## Task 2: #[allow(dead_code)] cleanup (62 lines) - Deleted new_with_outputs() from inline_boundary.rs (truly dead, deprecated) - Deleted extract_type_hint() from generic_type_resolver.rs (future placeholder) - Removed 3 incorrect annotations (code IS actually used) - Added clear comments for future-work items ## Task 3: Test organization (0 lines, +26 doc lines) - Added 4-section navigation to loop_scope_shape/tests.rs - Improved test discoverability (17 tests → organized by module) - Low-risk organization improvement - Easy path for future per-module test file splitting ## Summary - Total deletion: 102 net lines - Files modified: 9 - Build status: ✅ Clean (0 errors, 0 warnings) - Test status: ✅ 21/21 PASS - Regressions: 0 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@ -35,15 +35,14 @@ impl MirBuilder {
|
||||
/// # Phase 188-Impl-2: Host Variable Integration
|
||||
///
|
||||
/// Extracts the loop variable from the host function (e.g., `i` from `i < 3`)
|
||||
/// and passes it to the Pattern 1 lowerer along with a ValueId allocator.
|
||||
/// and creates a JoinInlineBoundary for mapping between host and JoinIR ValueIds.
|
||||
///
|
||||
/// # Pipeline
|
||||
/// 1. Extract loop variable name from condition
|
||||
/// 2. Look up ValueId in host variable_map
|
||||
/// 3. Create Pattern1Context with host variable + allocator
|
||||
/// 4. Call simple_while_minimal::lower_simple_while_minimal() → JoinModule
|
||||
/// 5. convert_join_module_to_mir_with_meta() → MirModule
|
||||
/// 6. Merge MIR blocks into current_function
|
||||
/// 3. Call simple_while_minimal::lower_simple_while_minimal() → JoinModule
|
||||
/// 4. convert_join_module_to_mir_with_meta() → MirModule
|
||||
/// 5. Merge MIR blocks into current_function
|
||||
pub(in crate::mir::builder) fn cf_loop_pattern1_minimal(
|
||||
&mut self,
|
||||
condition: &ASTNode,
|
||||
@ -51,9 +50,7 @@ impl MirBuilder {
|
||||
_func_name: &str,
|
||||
debug: bool,
|
||||
) -> Result<Option<ValueId>, String> {
|
||||
use crate::mir::join_ir::lowering::simple_while_minimal::{
|
||||
lower_simple_while_minimal, Pattern1Context,
|
||||
};
|
||||
use crate::mir::join_ir::lowering::simple_while_minimal::lower_simple_while_minimal;
|
||||
use crate::mir::BasicBlockId;
|
||||
use std::collections::{BTreeMap, BTreeSet};
|
||||
|
||||
@ -89,16 +86,8 @@ impl MirBuilder {
|
||||
variable_definitions: BTreeMap::new(),
|
||||
};
|
||||
|
||||
// Phase 188-Impl-2: Create Pattern1Context with host variable + allocator
|
||||
// Clone value_gen to move into closure
|
||||
let mut value_gen_clone = self.value_gen.clone();
|
||||
let ctx = Pattern1Context {
|
||||
loop_var: loop_var_id,
|
||||
value_allocator: Box::new(move || value_gen_clone.next()),
|
||||
};
|
||||
|
||||
// Call Pattern 1 lowerer with host context
|
||||
let join_module = match lower_simple_while_minimal(scope, Some(ctx)) {
|
||||
// Call Pattern 1 lowerer
|
||||
let join_module = match lower_simple_while_minimal(scope) {
|
||||
Some(module) => module,
|
||||
None => {
|
||||
// Phase 195: Use unified trace
|
||||
|
||||
Reference in New Issue
Block a user