Enum AstBlockItem
pub enum AstBlockItem {
Declaration(AstDeclaration),
Statement(AstStatement),
}Expand description
An item in a block can be a statement or a declaration.
In C, declarations (even with initializers) are not statements. E.g. this is invalid C code (but is valid C++):
if (condition)
int a = 1;So we treat declarations separately from statements. A declaration with an initializer expression will be translated into IR so that the initializer expression becomes an assignment.
Note: Type alias (typedef) declarations do not appear in our AST. The Parser handles them during parsing but has no need to construct them in the AST.
Variants§
Declaration(AstDeclaration)
Statement(AstStatement)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AstBlockItem
impl RefUnwindSafe for AstBlockItem
impl Send for AstBlockItem
impl Sync for AstBlockItem
impl Unpin for AstBlockItem
impl UnwindSafe for AstBlockItem
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