mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
add pointer Layout
This commit is contained in:
parent
e4566b9757
commit
fbadd9d620
3 changed files with 10 additions and 1 deletions
|
@ -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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue