add pointer Layout

This commit is contained in:
Folkert 2020-03-20 11:53:21 +01:00
parent e4566b9757
commit fbadd9d620
3 changed files with 10 additions and 1 deletions

View file

@ -13,6 +13,7 @@ pub enum Layout<'a> {
Union(&'a [&'a [Layout<'a>]]),
/// A function. The types of its arguments, then the type of its return value.
FunctionPointer(&'a [Layout<'a>], &'a Layout<'a>),
Pointer(&'a Layout<'a>),
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
@ -93,6 +94,10 @@ impl<'a> Layout<'a> {
// Function pointers are immutable and can always be safely copied
true
}
Pointer(_) => {
// TODO is this accurate?
true
}
}
}
@ -121,6 +126,7 @@ impl<'a> Layout<'a> {
.max()
.unwrap_or_default(),
FunctionPointer(_, _) => pointer_size,
Pointer(_) => pointer_size,
}
}
}