mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 00:24:34 +00:00
remove a wrapped
This commit is contained in:
parent
1c8a21e42c
commit
95c952a1ae
2 changed files with 11 additions and 6 deletions
|
@ -5642,9 +5642,6 @@ fn store_pattern_help<'a>(
|
||||||
tag_id,
|
tag_id,
|
||||||
..
|
..
|
||||||
} => {
|
} => {
|
||||||
let union_layout = Layout::Union(*layout);
|
|
||||||
let wrapped = Wrapped::from_layout(&union_layout);
|
|
||||||
|
|
||||||
return store_tag_pattern(
|
return store_tag_pattern(
|
||||||
env,
|
env,
|
||||||
procs,
|
procs,
|
||||||
|
@ -5652,7 +5649,6 @@ fn store_pattern_help<'a>(
|
||||||
outer_symbol,
|
outer_symbol,
|
||||||
*layout,
|
*layout,
|
||||||
&arguments,
|
&arguments,
|
||||||
wrapped,
|
|
||||||
*tag_id,
|
*tag_id,
|
||||||
stmt,
|
stmt,
|
||||||
);
|
);
|
||||||
|
@ -5697,13 +5693,12 @@ fn store_tag_pattern<'a>(
|
||||||
structure: Symbol,
|
structure: Symbol,
|
||||||
union_layout: UnionLayout<'a>,
|
union_layout: UnionLayout<'a>,
|
||||||
arguments: &[(Pattern<'a>, Layout<'a>)],
|
arguments: &[(Pattern<'a>, Layout<'a>)],
|
||||||
wrapped: Wrapped,
|
|
||||||
tag_id: u8,
|
tag_id: u8,
|
||||||
mut stmt: Stmt<'a>,
|
mut stmt: Stmt<'a>,
|
||||||
) -> StorePattern<'a> {
|
) -> StorePattern<'a> {
|
||||||
use Pattern::*;
|
use Pattern::*;
|
||||||
|
|
||||||
let write_tag = wrapped == Wrapped::MultiTagUnion;
|
let write_tag = union_layout.stores_tag();
|
||||||
|
|
||||||
let mut arg_layouts = Vec::with_capacity_in(arguments.len(), env.arena);
|
let mut arg_layouts = Vec::with_capacity_in(arguments.len(), env.arena);
|
||||||
let mut is_productive = false;
|
let mut is_productive = false;
|
||||||
|
|
|
@ -171,6 +171,16 @@ impl<'a> UnionLayout<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn stores_tag(&self) -> bool {
|
||||||
|
match self {
|
||||||
|
UnionLayout::NonRecursive(_) => true,
|
||||||
|
UnionLayout::Recursive(_) => true,
|
||||||
|
UnionLayout::NonNullableUnwrapped(_) => false,
|
||||||
|
UnionLayout::NullableWrapped { .. } => true,
|
||||||
|
UnionLayout::NullableUnwrapped { .. } => false,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue