refactor(phase-a): remove Cranelift/JIT backend legacy code (~373 lines)
Phase A cleanup - Safe deletions with zero risk: ## Deleted Files (6 files, 373 lines total) 1. Cranelift/JIT Backend (321 lines): - src/runner/modes/cranelift.rs (45 lines) - src/runner/modes/aot.rs (55 lines) - src/runner/jit_direct.rs (152 lines) - src/tests/core13_smoke_jit.rs (42 lines) - src/tests/core13_smoke_jit_map.rs (27 lines) 2. Legacy MIR Builder (52 lines): - src/mir/builder/exprs_legacy.rs - Functionality inlined into exprs.rs (control flow constructs) ## Module Reference Cleanup - src/backend/mod.rs: Removed cranelift feature gate exports - src/runner/mod.rs: Removed jit_direct module reference - src/runner/modes/mod.rs: Removed aot module reference - src/mir/builder.rs: Removed exprs_legacy module ## Impact Analysis - Build: Success (cargo build --release) - Tests: All passing - Risk Level: None (feature already archived, code unused) - Related: Phase 15 JIT archival (archive/jit-cranelift/) ## BID Copilot Status - Already removed in previous cleanup - Not part of this commit Total Reduction: 373 lines (~0.4% of codebase) Next: Phase B - Dead code investigation Related: #phase-21.0-cleanup Part of: Legacy Code Cleanup Initiative
This commit is contained in:
@ -5,17 +5,44 @@ use crate::ast::{ASTNode, AssignStmt, ReturnStmt, BinaryExpr, CallExpr, MethodCa
|
||||
impl super::MirBuilder {
|
||||
// Main expression dispatcher
|
||||
pub(super) fn build_expression_impl(&mut self, ast: ASTNode) -> Result<ValueId, String> {
|
||||
if matches!(
|
||||
ast,
|
||||
ASTNode::Program { .. }
|
||||
| ASTNode::If { .. }
|
||||
| ASTNode::Loop { .. }
|
||||
| ASTNode::TryCatch { .. }
|
||||
| ASTNode::Throw { .. }
|
||||
) {
|
||||
return self.build_expression_impl_legacy(ast);
|
||||
}
|
||||
match ast {
|
||||
// Control flow constructs (formerly in exprs_legacy)
|
||||
ASTNode::Program { statements, .. } => {
|
||||
// Sequentially lower statements and return last value (or Void)
|
||||
self.cf_block(statements)
|
||||
}
|
||||
ASTNode::Print { expression, .. } => {
|
||||
self.build_print_statement(*expression)
|
||||
}
|
||||
ASTNode::If {
|
||||
condition,
|
||||
then_body,
|
||||
else_body,
|
||||
..
|
||||
} => {
|
||||
use crate::ast::Span;
|
||||
let then_node = ASTNode::Program {
|
||||
statements: then_body,
|
||||
span: Span::unknown(),
|
||||
};
|
||||
let else_node = else_body.map(|b| ASTNode::Program {
|
||||
statements: b,
|
||||
span: Span::unknown(),
|
||||
});
|
||||
self.cf_if(*condition, then_node, else_node)
|
||||
}
|
||||
ASTNode::Loop { condition, body, .. } => {
|
||||
self.cf_loop(*condition, body)
|
||||
}
|
||||
ASTNode::TryCatch {
|
||||
try_body,
|
||||
catch_clauses,
|
||||
finally_body,
|
||||
..
|
||||
} => self.cf_try_catch(try_body, catch_clauses, finally_body),
|
||||
ASTNode::Throw { expression, .. } => self.cf_throw(*expression),
|
||||
|
||||
// Regular expressions
|
||||
ASTNode::Literal { value, .. } => self.build_literal(value),
|
||||
|
||||
node @ ASTNode::BinaryOp { .. } => {
|
||||
|
||||
Reference in New Issue
Block a user