Locked in type model
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user