Add Place
getter to Operand
This commit is contained in:
parent
2ed25f0697
commit
a64cd59224
1 changed files with 9 additions and 0 deletions
|
@ -1993,6 +1993,15 @@ impl<'tcx> Operand<'tcx> {
|
|||
Operand::Move(place) => Operand::Copy(place),
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the `Place` that is the target of this `Operand`, or `None` if this `Operand` is a
|
||||
/// constant.
|
||||
pub fn place(&self) -> Option<&Place<'tcx>> {
|
||||
match self {
|
||||
Operand::Copy(place) | Operand::Move(place) => Some(place),
|
||||
Operand::Constant(_) => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue