Merge remote-tracking branch 'origin/trunk' into reset-reuse

This commit is contained in:
Folkert 2021-07-13 00:44:05 +02:00
commit e02d950c7c
50 changed files with 2387 additions and 992 deletions

View file

@ -208,6 +208,15 @@ impl<'a> UnionLayout<'a> {
UnionLayout::NullableUnwrapped { nullable_id, .. } => *nullable_id == (tag_id != 0),
}
}
pub fn is_nullable(&self) -> bool {
match self {
UnionLayout::NonRecursive(_)
| UnionLayout::Recursive(_)
| UnionLayout::NonNullableUnwrapped { .. } => false,
UnionLayout::NullableWrapped { .. } | UnionLayout::NullableUnwrapped { .. } => true,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]