mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 14:24:45 +00:00
use vec
This commit is contained in:
parent
3bbf1a5506
commit
cf05afeacc
1 changed files with 5 additions and 6 deletions
|
@ -1261,7 +1261,7 @@ fn layout_from_flat_type<'a>(
|
||||||
TagUnion(tags, ext_var) => {
|
TagUnion(tags, ext_var) => {
|
||||||
debug_assert!(ext_var_is_empty_tag_union(subs, ext_var));
|
debug_assert!(ext_var_is_empty_tag_union(subs, ext_var));
|
||||||
|
|
||||||
let mut new_tags = MutMap::default();
|
let mut new_tags = std::vec::Vec::with_capacity(tags.len());
|
||||||
|
|
||||||
for (tag_index, index) in tags.iter_all() {
|
for (tag_index, index) in tags.iter_all() {
|
||||||
let tag = subs[tag_index].clone();
|
let tag = subs[tag_index].clone();
|
||||||
|
@ -1272,7 +1272,7 @@ fn layout_from_flat_type<'a>(
|
||||||
new_vars.push(var);
|
new_vars.push(var);
|
||||||
}
|
}
|
||||||
|
|
||||||
new_tags.insert(tag, new_vars);
|
new_tags.push((tag, new_vars));
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(layout_from_tag_union(arena, new_tags, subs))
|
Ok(layout_from_tag_union(arena, new_tags, subs))
|
||||||
|
@ -1280,8 +1280,7 @@ fn layout_from_flat_type<'a>(
|
||||||
FunctionOrTagUnion(tag_name, _, ext_var) => {
|
FunctionOrTagUnion(tag_name, _, ext_var) => {
|
||||||
debug_assert!(ext_var_is_empty_tag_union(subs, ext_var));
|
debug_assert!(ext_var_is_empty_tag_union(subs, ext_var));
|
||||||
|
|
||||||
let mut tags = MutMap::default();
|
let tags = std::vec![(subs[tag_name].clone(), std::vec::Vec::new())];
|
||||||
tags.insert(subs[tag_name].clone(), vec![]);
|
|
||||||
|
|
||||||
Ok(layout_from_tag_union(arena, tags, subs))
|
Ok(layout_from_tag_union(arena, tags, subs))
|
||||||
}
|
}
|
||||||
|
@ -1624,7 +1623,7 @@ pub fn union_sorted_tags_help<'a>(
|
||||||
subs: &Subs,
|
subs: &Subs,
|
||||||
) -> UnionVariant<'a> {
|
) -> UnionVariant<'a> {
|
||||||
// sort up front; make sure the ordering stays intact!
|
// sort up front; make sure the ordering stays intact!
|
||||||
tags_vec.sort();
|
tags_vec.sort_unstable_by(|(a, _), (b, _)| a.cmp(b));
|
||||||
|
|
||||||
let mut env = Env {
|
let mut env = Env {
|
||||||
arena,
|
arena,
|
||||||
|
@ -1831,7 +1830,7 @@ pub fn union_sorted_tags_help<'a>(
|
||||||
|
|
||||||
pub fn layout_from_tag_union<'a>(
|
pub fn layout_from_tag_union<'a>(
|
||||||
arena: &'a Bump,
|
arena: &'a Bump,
|
||||||
tags: MutMap<TagName, std::vec::Vec<Variable>>,
|
tags: std::vec::Vec<(TagName, std::vec::Vec<Variable>)>,
|
||||||
subs: &Subs,
|
subs: &Subs,
|
||||||
) -> Layout<'a> {
|
) -> Layout<'a> {
|
||||||
use UnionVariant::*;
|
use UnionVariant::*;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue