pub enum Statement {
Show 27 variants
Expression(Expression),
VarDeclaration {
kind: VarKind,
decls: Vec<(Pattern, Option<Expression>)>,
},
Block(Vec<Statement>),
If {
test: Box<Expression>,
consequent: Box<Statement>,
alternate: Option<Box<Statement>>,
},
While {
test: Expression,
body: Box<Statement>,
},
DoWhile {
body: Box<Statement>,
test: Expression,
},
For {
init: Option<Box<Statement>>,
test: Option<Box<Expression>>,
update: Option<Box<Expression>>,
body: Box<Statement>,
},
ForIn {
decl_kind: Option<VarKind>,
pattern: Pattern,
object: Box<Expression>,
body: Box<Statement>,
of: bool,
is_await: bool,
},
FunctionDeclaration {
name: Rc<str>,
params: Rc<Vec<Param>>,
body: Rc<FnBody>,
is_async: bool,
is_generator: bool,
},
Return(Option<Expression>),
Break(Option<Rc<str>>),
Continue(Option<Rc<str>>),
Labeled(Rc<str>, Box<Statement>),
Throw(Expression),
Switch {
discriminant: Box<Expression>,
cases: Vec<SwitchCase>,
},
Try(Box<TryStmt>),
Import(Box<ImportDecl>),
ExportNamed {
specifiers: Vec<(String, String)>,
source: Option<String>,
},
ExportDefault(Expression),
ExportDecl {
declaration: Box<Statement>,
names: Vec<String>,
},
ExportAll {
source: String,
},
InitPrivateBrand(u64),
InitPrivateField {
brand: u64,
name: Rc<str>,
init: Option<Box<Expression>>,
},
InitPublicField {
key: Rc<str>,
init: Option<Box<Expression>>,
},
ClassFieldInit {
stmts: Vec<Statement>,
priv_names: Vec<Rc<str>>,
},
With {
object: Box<Expression>,
body: Box<Statement>,
},
Empty,
}Variants§
Expression(Expression)
VarDeclaration
Block(Vec<Statement>)
If
While
DoWhile
For
ForIn
Fields
§
object: Box<Expression>FunctionDeclaration
Return(Option<Expression>)
Break(Option<Rc<str>>)
break; / break label;。
Continue(Option<Rc<str>>)
continue; / continue label;。
Labeled(Rc<str>, Box<Statement>)
label: statement(ラベル付き文。主にループの break label/continue label の
ターゲットとして使う)。
Throw(Expression)
Switch
Try(Box<TryStmt>)
try/catch/finally。【2026-10-27】4 つの本体で 80 バイトあり Statement 全体を太らせていたので
箱に入れた(中身は TryStmt)。
Import(Box<ImportDecl>)
import ... from "spec" 宣言。
例: import def, { a, b as c }, * as ns from "mod"。
import ...(中身は ImportDecl。文の列挙を小さく保つため箱に入れる)。
ExportNamed
export { a, b as c } / export { x } from "mod"(再エクスポート)。
Fields
ExportDefault(Expression)
export default <expr>。
ExportDecl
export var/let/const/function/class ...(宣言を実行しつつ名前を export)。
内側の宣言文と、そこから公開する名前のリストを保持する。
ExportAll
export * from "mod"(全名前の再エクスポート)。
InitPrivateBrand(u64)
クラスインスタンスへのプライベートブランド付与(内部専用)。
InitPrivateField
クラスインスタンスへのプライベートフィールド定義(内部専用)。
InitPublicField
クラスインスタンスのパブリックフィールド定義(内部専用。CreateDataPropertyOrThrow、無名関数の NamedEvaluation 付き)。
ClassFieldInit
クラスインスタンスフィールド初期化列(direct eval 静的文脈付与用)。
With
with (object) body。
Empty
Trait Implementations§
impl StructuralPartialEq for Statement
Auto Trait Implementations§
impl !RefUnwindSafe for Statement
impl !Send for Statement
impl !Sync for Statement
impl !UnwindSafe for Statement
impl Freeze for Statement
impl Unpin for Statement
impl UnsafeUnpin for Statement
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