bea5c925913760a721eb11f2192f2d008ca42c49
Fourth slice of the codegen split. Pulls the closure-emission
cluster into a dedicated module. No behaviour change.
Methods moved:
- lower_lambda (~290 lines, pub(crate)): capture analysis +
thunk fn lifting + heap-env construction + closure-pair
packing + per-pair drop-fn emission under --alloc=rc.
- collect_captures (~108 lines, private): recursive free-var
walk used only as lower_lambda's prelude.
- pattern_bound_names (~17 lines, private): pattern-binder
enumeration used by collect_captures's match arm.
Imports: super::escape (for analyze_fn_body), super::synth
(for fn_sig_from_type, llvm_type), the usual Emitter/Result
re-exports.
lib.rs drops from 3237 → 2825 lines. lambda.rs is 447 lines.
Codegen split summary (5295 → 2825 lib.rs, ~47% reduction):
lib.rs 2825 — Emitter struct, lifecycle (new,
start_block, emit_module, emit_*),
lower_term mass dispatcher, app/eq/effect
lowering, lookup helpers, synth helpers.
match_lower.rs 935 — Term::Ctor / ReuseAs / Match.
escape.rs 722 — escape analysis (predates the split).
drop.rs 696 — per-type drop fns + per-let-close drop.
lambda.rs 447 — Term::Lam + closure machinery.
subst.rs 319 — monomorphisation substitution.
synth.rs 216 — IR shaping helpers + builtin types.
cargo test --workspace clean across all four phases.
Description
No description provided
Languages
Rust
91.6%
Python
4.6%
C
1.8%
LLVM
1.6%
Shell
0.4%