Skip to main content

JavaStmt

Enum JavaStmt 

Source
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;

Fields

§name: String
§is_final: bool
§

If(JavaExpr, Vec<JavaStmt>, Vec<JavaStmt>)

If statement: if (cond) { then } else { else_ }

§

Switch

Switch expression/statement

Fields

§scrutinee: JavaExpr
§default: Vec<JavaStmt>
§

For

Classic for loop: for (init; cond; update) { body }

§

ForEach

Enhanced for loop: for (Type elem : iterable) { body }

Fields

§elem: String
§iterable: JavaExpr
§

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

Fields

§finally: Vec<JavaStmt>
§

TryWithResources

Try-with-resources

Fields

§resources: Vec<(String, JavaExpr)>
§finally: Vec<JavaStmt>
§

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§

Source§

impl Clone for JavaStmt

Source§

fn clone(&self) -> JavaStmt

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for JavaStmt

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for JavaStmt

Source§

fn eq(&self, other: &JavaStmt) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for JavaStmt

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.