mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 00:24:34 +00:00
Use tail call elimination where possible in ==
for tag unions
This commit is contained in:
parent
65a9464d98
commit
0d8a2c8a49
2 changed files with 220 additions and 38 deletions
|
@ -956,7 +956,17 @@ impl<'a> WasmBackend<'a> {
|
|||
NonRecursive(tags) => tags[tag_index],
|
||||
Recursive(tags) => tags[tag_index],
|
||||
NonNullableUnwrapped(layouts) => *layouts,
|
||||
NullableWrapped { other_tags, .. } => other_tags[tag_index],
|
||||
NullableWrapped {
|
||||
other_tags,
|
||||
nullable_id,
|
||||
} => {
|
||||
let index = if tag_index > *nullable_id as usize {
|
||||
tag_index - 1
|
||||
} else {
|
||||
tag_index
|
||||
};
|
||||
other_tags[index]
|
||||
}
|
||||
NullableUnwrapped { other_fields, .. } => *other_fields,
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue