Locked in type model

This commit is contained in:
2026-10-08 07:28:51 +00:00
parent 2b612d19ed
commit 316a2fcd75
13 changed files with 1707 additions and 1358 deletions
+7 -3
View File
@@ -48,14 +48,18 @@ pub fn transform(
fn transform_one(mut f: FlatFn, captures: &[Vec<ClosureVar>], atoms: &[Atom]) -> FlatFn {
let code = declass(&f.code);
// Temp locals, after the fn's own, for the args of a `new` (see replace_new())
// Temp locals, after the fn's own, for the args of a `new` (see
// replace_new()). Each `new` has its own: a local has one type for its
// whole fn, so shared temps would join the args of every `new` in it
let temps = f.var_count;
let n_temps = code.iter().filter_map(is_new).max().unwrap_or(0);
let n_temps: usize = code.iter().filter_map(is_new).sum();
let mut next_temp = temps;
let mut out = Vec::with_capacity(code.len());
for instr in &code {
if replace_new(instr, temps, &mut out) {
if replace_new(instr, next_temp, &mut out) {
next_temp += is_new(instr).unwrap();
continue;
}