pub enum JsStmt {
Expr(JsExpr),
Let(String, JsExpr),
Const(String, JsExpr),
Return(JsExpr),
ReturnVoid,
If(JsExpr, Vec<JsStmt>, Vec<JsStmt>),
While(JsExpr, Vec<JsStmt>),
For(String, JsExpr, Vec<JsStmt>),
Block(Vec<JsStmt>),
Throw(JsExpr),
TryCatch(Vec<JsStmt>, String, Vec<JsStmt>),
Switch(JsExpr, Vec<(JsExpr, Vec<JsStmt>)>, Vec<JsStmt>),
}Expand description
JavaScript statement for code generation.
Variants§
Expr(JsExpr)
Expression statement: expr;
Let(String, JsExpr)
Let binding: let x = expr;
Const(String, JsExpr)
Const binding: const x = expr;
Return(JsExpr)
Return statement: return expr;
ReturnVoid
Void return: return;
If(JsExpr, Vec<JsStmt>, Vec<JsStmt>)
If-else: if (cond) { then } else { else_ }
While(JsExpr, Vec<JsStmt>)
While loop: while (cond) { body }
For(String, JsExpr, Vec<JsStmt>)
For-of loop: for (const x of iter) { body }
Block(Vec<JsStmt>)
Block: { stmts }
Throw(JsExpr)
Throw statement: throw expr;
TryCatch(Vec<JsStmt>, String, Vec<JsStmt>)
Try-catch: try { body } catch (e) { handler }
Switch(JsExpr, Vec<(JsExpr, Vec<JsStmt>)>, Vec<JsStmt>)
Switch statement: switch (expr) { case ...: ... default: ... }
Trait Implementations§
impl StructuralPartialEq for JsStmt
Auto Trait Implementations§
impl Freeze for JsStmt
impl RefUnwindSafe for JsStmt
impl Send for JsStmt
impl Sync for JsStmt
impl Unpin for JsStmt
impl UnsafeUnpin for JsStmt
impl UnwindSafe for JsStmt
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