mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 14:24:45 +00:00
Swap closure indices in alias analysis
This commit is contained in:
parent
90401477c9
commit
c6a8bdfdbe
1 changed files with 41 additions and 29 deletions
|
@ -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(
|
|
||||||
env,
|
|
||||||
procs,
|
|
||||||
layout_cache,
|
|
||||||
args[2].0,
|
|
||||||
Located::at_zero(args[2].1.clone()),
|
|
||||||
arg_symbols[2],
|
|
||||||
stmt,
|
|
||||||
);
|
|
||||||
|
|
||||||
assign_to_symbol(
|
assign_to_symbol(
|
||||||
env,
|
env,
|
||||||
procs,
|
procs,
|
||||||
layout_cache,
|
layout_cache,
|
||||||
args[1].0,
|
args[ARG_INDEX].0,
|
||||||
Located::at_zero(args[1].1.clone()),
|
Located::at_zero(args[ARG_INDEX].1.clone()),
|
||||||
arg_symbols[1],
|
arg_symbols[ARG_INDEX],
|
||||||
stmt,
|
stmt,
|
||||||
)
|
)
|
||||||
|
};
|
||||||
|
|
||||||
|
let stmt = {
|
||||||
|
const ARG_INDEX: usize = 1;
|
||||||
|
|
||||||
|
assign_to_symbol(
|
||||||
|
env,
|
||||||
|
procs,
|
||||||
|
layout_cache,
|
||||||
|
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);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue