mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 08:34:33 +00:00
cleanup reversed stores to make logic clearer
This commit is contained in:
parent
2fb093d4c8
commit
3e39a32f0e
1 changed files with 10 additions and 20 deletions
|
@ -1580,26 +1580,16 @@ fn store_list_pattern<'a>(
|
||||||
},
|
},
|
||||||
arguments: env.arena.alloc([list_sym, start_sym, rest_len_sym]),
|
arguments: env.arena.alloc([list_sym, start_sym, rest_len_sym]),
|
||||||
});
|
});
|
||||||
stmt = Stmt::Let(*rest_sym, rest_expr, list_layout, env.arena.alloc(stmt));
|
let needed_stores = [
|
||||||
stmt = Stmt::Let(start_sym, start_expr, usize_layout, env.arena.alloc(stmt));
|
(total_dropped_sym, total_dropped_expr, usize_layout),
|
||||||
stmt = Stmt::Let(
|
(list_len_sym, list_len_expr, usize_layout),
|
||||||
rest_len_sym,
|
(rest_len_sym, rest_len_expr, usize_layout),
|
||||||
rest_len_expr,
|
(start_sym, start_expr, usize_layout),
|
||||||
usize_layout,
|
(*rest_sym, rest_expr, list_layout),
|
||||||
env.arena.alloc(stmt),
|
];
|
||||||
);
|
for (sym, expr, lay) in needed_stores.into_iter().rev() {
|
||||||
stmt = Stmt::Let(
|
stmt = Stmt::Let(sym, expr, lay, env.arena.alloc(stmt));
|
||||||
list_len_sym,
|
}
|
||||||
list_len_expr,
|
|
||||||
usize_layout,
|
|
||||||
env.arena.alloc(stmt),
|
|
||||||
);
|
|
||||||
stmt = Stmt::Let(
|
|
||||||
total_dropped_sym,
|
|
||||||
total_dropped_expr,
|
|
||||||
usize_layout,
|
|
||||||
env.arena.alloc(stmt),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if is_productive {
|
if is_productive {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue