Skip to main content

Statement

Enum Statement 

Source
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

Fields

§kind: VarKind
§

Block(Vec<Statement>)

§

If

Fields

§consequent: Box<Statement>
§alternate: Option<Box<Statement>>
§

While

Fields

§

DoWhile

Fields

§

For

§

ForIn

Fields

§decl_kind: Option<VarKind>
§pattern: Pattern
§object: Box<Expression>
§of: bool
§is_await: bool

for await (x of iterable)。Symbol.asyncIterator があればそれを駆動し、 無ければ同期イテラブルの各要素を await するフォールバック(of の時のみ意味を持つ)。

§

FunctionDeclaration

Fields

§name: Rc<str>
§params: Rc<Vec<Param>>
§body: Rc<FnBody>
§is_async: bool
§is_generator: bool
§

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

Fields

§discriminant: Box<Expression>
§

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

§specifiers: Vec<(String, String)>

(ローカル名 or 元名, 公開する export 名)。

§source: Option<String>

再エクスポート元の指定子(export { x } from "mod")。None なら自モジュール。

§

ExportDefault(Expression)

export default <expr>。

§

ExportDecl

export var/let/const/function/class ...(宣言を実行しつつ名前を export)。 内側の宣言文と、そこから公開する名前のリストを保持する。

Fields

§declaration: Box<Statement>
§names: Vec<String>
§

ExportAll

export * from "mod"(全名前の再エクスポート)。

Fields

§source: String
§

InitPrivateBrand(u64)

クラスインスタンスへのプライベートブランド付与(内部専用)。

§

InitPrivateField

クラスインスタンスへのプライベートフィールド定義(内部専用)。

Fields

§brand: u64
§name: Rc<str>
§

InitPublicField

クラスインスタンスのパブリックフィールド定義(内部専用。CreateDataPropertyOrThrow、無名関数の NamedEvaluation 付き)。

Fields

§key: Rc<str>
§

ClassFieldInit

クラスインスタンスフィールド初期化列(direct eval 静的文脈付与用)。

Fields

§priv_names: Vec<Rc<str>>
§

With

with (object) body。

Fields

§object: Box<Expression>
§

Empty

Trait Implementations§

Source§

impl Clone for Statement

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Statement

Source§

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

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

impl PartialEq for Statement

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Statement

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> Same for T

Source§

type Output = T

Should always be Self
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.