Swap closure indices in alias analysis

This commit is contained in:
Richard Feldman 2021-10-06 08:06:50 -04:00
parent 90401477c9
commit c6a8bdfdbe

View file

@ -4039,7 +4039,7 @@ pub fn with_hole<'a>(
ListWalk | ListWalkUntil | ListWalkBackwards | DictWalk => { ListWalk | ListWalkUntil | ListWalkBackwards | DictWalk => {
debug_assert_eq!(arg_symbols.len(), 3); debug_assert_eq!(arg_symbols.len(), 3);
let closure_index = 1; let closure_index = 2;
let closure_data_symbol = arg_symbols[closure_index]; let closure_data_symbol = arg_symbols[closure_index];
let closure_data_var = args[closure_index].0; let closure_data_var = args[closure_index].0;
@ -4050,7 +4050,7 @@ pub fn with_hole<'a>(
closure_data_symbol, closure_data_symbol,
closure_data_var, closure_data_var,
op, op,
[arg_symbols[0], arg_symbols[2]], [arg_symbols[0], arg_symbols[1]],
layout, layout,
assigned, assigned,
hole hole
@ -4062,35 +4062,47 @@ pub fn with_hole<'a>(
// actual closure, and the default is either the number 1 or 0 // actual closure, and the default is either the number 1 or 0
// this can be removed when we define builtin modules as proper modules // this can be removed when we define builtin modules as proper modules
let stmt = assign_to_symbol( let stmt = {
env, const ARG_INDEX: usize = 0;
procs,
layout_cache,
args[0].0,
Located::at_zero(args[0].1.clone()),
arg_symbols[0],
stmt,
);
let stmt = assign_to_symbol( assign_to_symbol(
env, env,
procs, procs,
layout_cache, layout_cache,
args[2].0, args[ARG_INDEX].0,
Located::at_zero(args[2].1.clone()), Located::at_zero(args[ARG_INDEX].1.clone()),
arg_symbols[2], arg_symbols[ARG_INDEX],
stmt, stmt,
); )
};
assign_to_symbol( let stmt = {
env, const ARG_INDEX: usize = 1;
procs,
layout_cache, assign_to_symbol(
args[1].0, env,
Located::at_zero(args[1].1.clone()), procs,
arg_symbols[1], layout_cache,
stmt, args[ARG_INDEX].0,
) Located::at_zero(args[ARG_INDEX].1.clone()),
arg_symbols[ARG_INDEX],
stmt,
)
};
{
const ARG_INDEX: usize = 2;
assign_to_symbol(
env,
procs,
layout_cache,
args[ARG_INDEX].0,
Located::at_zero(args[ARG_INDEX].1.clone()),
arg_symbols[ARG_INDEX],
stmt,
)
}
} }
ListMap2 => { ListMap2 => {
debug_assert_eq!(arg_symbols.len(), 3); debug_assert_eq!(arg_symbols.len(), 3);