Semantic layouts for tuples

This commit is contained in:
Ayaz Hafiz 2023-05-10 15:40:44 -05:00
parent c06ffc434b
commit 43d4135dc8
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
2 changed files with 11 additions and 1 deletions

View file

@ -8,6 +8,7 @@
pub enum SemanticRepr<'a> {
None,
Record(SemaRecord<'a>),
Tuple(SemaTuple),
}
impl<'a> SemanticRepr<'a> {
@ -16,9 +17,18 @@ impl<'a> SemanticRepr<'a> {
pub(super) fn record(fields: &'a [&'a str]) -> Self {
Self::Record(SemaRecord { fields })
}
pub(super) fn tuple(size: usize) -> Self {
Self::Tuple(SemaTuple { size })
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct SemaRecord<'a> {
pub fields: &'a [&'a str],
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct SemaTuple {
pub size: usize,
}