pub enum JavaStmt {
Show 16 variants
Expr(JavaExpr),
LocalVar {
ty: Option<JavaType>,
name: String,
init: Option<JavaExpr>,
is_final: bool,
},
If(JavaExpr, Vec<JavaStmt>, Vec<JavaStmt>),
Switch {
scrutinee: JavaExpr,
cases: Vec<(JavaExpr, Vec<JavaStmt>)>,
default: Vec<JavaStmt>,
},
For {
init: Option<Box<JavaStmt>>,
cond: Option<JavaExpr>,
update: Option<JavaExpr>,
body: Vec<JavaStmt>,
},
ForEach {
ty: JavaType,
elem: String,
iterable: JavaExpr,
body: Vec<JavaStmt>,
},
While(JavaExpr, Vec<JavaStmt>),
DoWhile(Vec<JavaStmt>, JavaExpr),
Return(Option<JavaExpr>),
Throw(JavaExpr),
TryCatch {
body: Vec<JavaStmt>,
catches: Vec<JavaCatchClause>,
finally: Vec<JavaStmt>,
},
TryWithResources {
resources: Vec<(String, JavaExpr)>,
body: Vec<JavaStmt>,
catches: Vec<JavaCatchClause>,
finally: Vec<JavaStmt>,
},
Synchronized(JavaExpr, Vec<JavaStmt>),
Break(Option<String>),
Continue(Option<String>),
Assert(JavaExpr, Option<JavaExpr>),
}Expand description
Java statement AST.
Variants§
Expr(JavaExpr)
Expression statement: expr;
LocalVar
Local variable declaration: Type name = init; or var name = init;
If(JavaExpr, Vec<JavaStmt>, Vec<JavaStmt>)
If statement: if (cond) { then } else { else_ }
Switch
Switch expression/statement
For
Classic for loop: for (init; cond; update) { body }
Fields
ForEach
Enhanced for loop: for (Type elem : iterable) { body }
While(JavaExpr, Vec<JavaStmt>)
While loop: while (cond) { body }
DoWhile(Vec<JavaStmt>, JavaExpr)
Do-while loop: do { body } while (cond);
Return(Option<JavaExpr>)
Return statement: return expr; or return;
Throw(JavaExpr)
Throw statement: throw expr;
TryCatch
Try-catch-finally
TryWithResources
Try-with-resources
Fields
§
catches: Vec<JavaCatchClause>Synchronized(JavaExpr, Vec<JavaStmt>)
Synchronized block: synchronized (lock) { body }
Break(Option<String>)
Break statement
Continue(Option<String>)
Continue statement
Assert(JavaExpr, Option<JavaExpr>)
Assert statement: assert cond : msg;
Trait Implementations§
impl StructuralPartialEq for JavaStmt
Auto Trait Implementations§
impl Freeze for JavaStmt
impl RefUnwindSafe for JavaStmt
impl Send for JavaStmt
impl Sync for JavaStmt
impl Unpin for JavaStmt
impl UnsafeUnpin for JavaStmt
impl UnwindSafe for JavaStmt
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