remove tag_id in favor of index

This commit is contained in:
HajagosNorbert 2023-11-13 14:58:31 +01:00
parent 347431d1df
commit 90223022af
No known key found for this signature in database
GPG key ID: 807F4444870DB673
8 changed files with 32 additions and 33 deletions

View file

@ -1438,12 +1438,13 @@ fn expr_spec<'a>(
},
UnionFieldPtrAtIndex {
index,
tag_id,
structure,
union_layout,
..
} => {
debug_assert_ne!(index.len(), 0);
let index = index[0];
debug_assert!(index.len() >= 2);
let tag_id = index[0] as u32;
let index = index[1];
let tag_value_id = env.symbols[structure];
let type_name_bytes = recursive_tag_union_name_bytes(union_layout).as_bytes();
@ -1460,7 +1461,7 @@ fn expr_spec<'a>(
builder.add_touch(block, heap_cell)?;
// next, unwrap the union at the tag id that we've got
let variant_id = builder.add_unwrap_union(block, union_data, *tag_id as u32)?;
let variant_id = builder.add_unwrap_union(block, union_data, tag_id)?;
let value = builder.add_get_tuple_field(block, variant_id, index as u32)?;