pub struct ControlStack {
stack: SmallVec<[ControlStackFrame; 32]>,
}
Expand description
The control stack.
Fields§
§stack: SmallVec<[ControlStackFrame; 32]>
Stack frames for control flow.
The 32 is set arbitrarily, we can adjust it as we see fit.
Implementations§
Source§impl ControlStack
impl ControlStack
Sourcepub fn mark_else(&mut self) -> Result<ControlStackFrame>
pub fn mark_else(&mut self) -> Result<ControlStackFrame>
Mark the else block of an if.
Sourcepub fn push(&mut self, frame: ControlStackFrame)
pub fn push(&mut self, frame: ControlStackFrame)
Push a control stack frame.
Sourcepub fn pop(&mut self) -> Result<ControlStackFrame>
pub fn pop(&mut self) -> Result<ControlStackFrame>
Pop a control stack frame.
Sourcepub fn label_from_depth(&self, depth: u32) -> Result<u16>
pub fn label_from_depth(&self, depth: u32) -> Result<u16>
Get the label of the control stack frame at given depth.
Sourcepub fn ret_ty(&self, depth: usize) -> Result<BlockType>
pub fn ret_ty(&self, depth: usize) -> Result<BlockType>
Get the return type of the control stack frame at given depth.
Sourcepub fn ty(&self, depth: usize) -> Result<ControlStackFrameType>
pub fn ty(&self, depth: usize) -> Result<ControlStackFrameType>
Get the type of the control stack frame at given depth.
Trait Implementations§
Source§impl Default for ControlStack
impl Default for ControlStack
Source§fn default() -> ControlStack
fn default() -> ControlStack
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ControlStack
impl RefUnwindSafe for ControlStack
impl Send for ControlStack
impl Sync for ControlStack
impl Unpin for ControlStack
impl UnwindSafe for ControlStack
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more