Update alias analysis, implementation for List.mapWithIndex

This commit is contained in:
ayazhafiz 2022-02-13 22:50:27 -05:00
parent 71f2444397
commit 886e4e07f6
4 changed files with 12 additions and 6 deletions

View file

@ -809,6 +809,7 @@ fn call_spec(
add_loop(builder, block, state_type, init_state, loop_body)
}
// List.mapWithIndex : List before, (before, Nat -> after) -> List after
ListMapWithIndex { xs } => {
let list = env.symbols[xs];
@ -818,7 +819,8 @@ fn call_spec(
let element = builder.add_bag_get(block, input_bag)?;
let index = builder.add_make_tuple(block, &[])?;
let new_element = call_function!(builder, block, [index, element]);
// before, Nat -> after
let new_element = call_function!(builder, block, [element, index]);
list_append(builder, block, update_mode_var, state, new_element)
};