pub struct IfStatement {
pub condition: Expression,
pub then_body: Vec<Statement>,
pub then_has_braces: bool,
pub else_body: Option<Vec<Statement>>,
pub location: SourceLocation,
}Fields§
§condition: Expression§then_body: Vec<Statement>§then_has_braces: bool§else_body: Option<Vec<Statement>>§location: SourceLocationImplementations§
Source§impl IfStatement
impl IfStatement
Sourcepub fn extract_null_check_variable(&self) -> Option<&str>
pub fn extract_null_check_variable(&self) -> Option<&str>
Extract variable from NULL check patterns: (ptr != NULL), (NULL != ptr), (ptr)
Sourcepub fn extract_nonzero_check_variable(&self) -> Option<&str>
pub fn extract_nonzero_check_variable(&self) -> Option<&str>
Extract variable from non-zero check patterns: (id > 0), (id != 0), (id), (self->id)
Sourcepub fn is_truthiness_check(&self) -> bool
pub fn is_truthiness_check(&self) -> bool
Check if condition is a simple truthiness test (just a variable)
Sourcepub fn has_single_statement(&self) -> bool
pub fn has_single_statement(&self) -> bool
Check if then body has exactly one statement
Trait Implementations§
Source§impl Clone for IfStatement
impl Clone for IfStatement
Source§impl Debug for IfStatement
impl Debug for IfStatement
Auto Trait Implementations§
impl Freeze for IfStatement
impl RefUnwindSafe for IfStatement
impl Send for IfStatement
impl Sync for IfStatement
impl Unpin for IfStatement
impl UnsafeUnpin for IfStatement
impl UnwindSafe for IfStatement
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