compiler: Add FramePointer::ratchet
This commit is contained in:
parent
acb62737ac
commit
7c0b5cf99f
1 changed files with 14 additions and 0 deletions
|
@ -1413,6 +1413,20 @@ pub enum FramePointer {
|
|||
MayOmit,
|
||||
}
|
||||
|
||||
impl FramePointer {
|
||||
/// It is intended that the "force frame pointer" transition is "one way"
|
||||
/// so this convenience assures such if used
|
||||
#[inline]
|
||||
pub fn ratchet(&mut self, rhs: FramePointer) -> FramePointer {
|
||||
*self = match (*self, rhs) {
|
||||
(FramePointer::Always, _) | (_, FramePointer::Always) => FramePointer::Always,
|
||||
(FramePointer::NonLeaf, _) | (_, FramePointer::NonLeaf) => FramePointer::NonLeaf,
|
||||
_ => FramePointer::MayOmit,
|
||||
};
|
||||
*self
|
||||
}
|
||||
}
|
||||
|
||||
impl FromStr for FramePointer {
|
||||
type Err = ();
|
||||
fn from_str(s: &str) -> Result<Self, ()> {
|
||||
|
|
Loading…
Add table
Reference in a new issue