mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
remove tag id from data bytes for non-recursive tags
This commit is contained in:
parent
98db393587
commit
98a9dc0945
24 changed files with 188 additions and 170 deletions
|
@ -109,6 +109,8 @@ impl<'a> UnionLayout<'a> {
|
|||
pub fn layout_at(self, tag_id: u8, index: usize) -> Layout<'a> {
|
||||
let result = match self {
|
||||
UnionLayout::NonRecursive(tag_layouts) => {
|
||||
let index = index - 1;
|
||||
|
||||
let field_layouts = tag_layouts[tag_id as usize];
|
||||
|
||||
// this cannot be recursive; return immediately
|
||||
|
@ -1583,7 +1585,9 @@ pub fn union_sorted_tags_help<'a>(
|
|||
let mut arg_layouts = Vec::with_capacity_in(arguments.len() + 1, arena);
|
||||
|
||||
// add the tag discriminant (size currently always hardcoded to i64)
|
||||
arg_layouts.push(Layout::Builtin(TAG_SIZE));
|
||||
if is_recursive {
|
||||
arg_layouts.push(Layout::Builtin(TAG_SIZE));
|
||||
}
|
||||
|
||||
for var in arguments {
|
||||
match Layout::from_var(&mut env, var) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue