mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 06:44:46 +00:00
Clearer variant names for StackMemoryLocation
This commit is contained in:
parent
2756425eb9
commit
cc6f83f284
2 changed files with 11 additions and 11 deletions
|
@ -3,15 +3,15 @@ use parity_wasm::elements::{Instruction, Instruction::*, ValueType};
|
|||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum StackMemoryLocation {
|
||||
CallerFrame(LocalId),
|
||||
OwnFrame(u32),
|
||||
FrameOffset(u32),
|
||||
PointerArg(LocalId),
|
||||
}
|
||||
|
||||
impl StackMemoryLocation {
|
||||
pub fn local_and_offset(&self, stack_frame_pointer: Option<LocalId>) -> (LocalId, u32) {
|
||||
match self {
|
||||
Self::CallerFrame(local_id) => (*local_id, 0),
|
||||
Self::OwnFrame(offset) => (stack_frame_pointer.unwrap(), *offset),
|
||||
Self::PointerArg(local_id) => (*local_id, 0),
|
||||
Self::FrameOffset(offset) => (stack_frame_pointer.unwrap(), *offset),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue