refactor(cleanup): Phase 285A1 Post-Implementation Cleanup

Code quality improvements after Phase 285A1 implementation:

**Task 1: Dead Code Cleanup**
- Removed unnecessary #[allow(dead_code)] from emit_weak_load()
- Function is actively used in weak_to_strong() method handler

**Task 2: Unused Import Removal (cargo fix)**
- edgecfg/api/mod.rs: Removed seq, if_, loop_, cleanup, verify_frag_invariants
- pattern3.rs: Removed BinaryOperator
- pattern2/api/mod.rs: Removed PromoteStepResult
- jump.rs: Removed EffectMask, Span
- Result: 6 unused imports eliminated

**Task 3: Deprecated Pattern Removal**
- Fixed 4 PlanKind::LoopWithPost deprecated warnings
- Updated to Phase 142 P0 architecture (statement-level normalization)
- Files: normalized_shadow_suffix_router_box.rs, routing.rs,
  execute_box.rs, plan.rs
- Removed 2 deprecated tests: test_loop_with_post_*

**Task 4: WeakFieldValidatorBox Boxification**
- Extracted weak field validation logic into dedicated Box
- New file: src/mir/builder/weak_field_validator.rs (147 lines)
- fields.rs: 277 → 237 lines (-40 lines, -14.4%)
- Added 5 unit tests for validation logic
- Follows Phase 33 boxification principles (single responsibility,
  testability, reusability)

**Metrics**:
- Code reduction: -40 lines in fields.rs
- Test coverage: +5 unit tests
- Warnings fixed: 4 deprecated warnings
- Imports cleaned: 6 unused imports

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-24 03:44:56 +09:00
parent cc8b27a1aa
commit 2da730de35
13 changed files with 365 additions and 87 deletions

View File

@ -1,6 +1,6 @@
//! Phase 282 P5: Pattern3 (Loop with If-Else PHI) Extraction
use crate::ast::{ASTNode, BinaryOperator};
use crate::ast::ASTNode;
#[derive(Debug, Clone)]
pub(crate) struct Pattern3Parts {

View File

@ -19,5 +19,5 @@ mod promote_decision;
mod promote_runner;
// Re-export the SSOT types and functions
pub(in crate::mir::builder) use promote_decision::{PromoteDecision, PromoteStepResult};
pub(in crate::mir::builder) use promote_decision::PromoteDecision;
pub(in crate::mir::builder) use promote_runner::try_promote;

View File

@ -61,14 +61,11 @@ impl NormalizedShadowSuffixRouterBox {
}
};
// Phase 142 P0: Accept both LoopOnly and LoopWithPost
// Normalization unit is now "statement (loop 1個)", not "block suffix"
// Phase 142 P0: Normalization unit is now "statement (loop only)", not "block suffix"
if debug {
let description = match &plan.kind {
PlanKind::LoopOnly => "Loop-only pattern".to_string(),
PlanKind::LoopWithPost { post_assign_count } => {
format!("Loop+post pattern: {} post assigns", post_assign_count)
}
_ => "Unknown pattern (should not happen)".to_string(),
};
trace.routing("suffix_router", func_name, &description);
}