Skip to main content

Expression

Enum Expression 

Source
pub enum Expression {
Show 31 variants Number(f64), BigIntLit(String), Str(String), Bool(bool), Null, Undefined, Identifier(String), This, TemplateLiteral { quasis: Vec<String>, exprs: Vec<Expression>, }, TaggedTemplate { tag: Box<Expression>, quasis: Vec<String>, raw: Vec<String>, exprs: Vec<Expression>, }, Array(Vec<Expression>), Object(Vec<Property>), Function { name: Option<String>, params: Vec<Param>, body: Vec<Statement>, is_arrow: bool, is_async: bool, is_generator: bool, }, Await(Box<Expression>), Yield { argument: Option<Box<Expression>>, delegate: bool, }, Unary { op: UnaryOp, expr: Box<Expression>, }, Update { op: String, prefix: bool, target: Box<Expression>, }, Binary { op: BinaryOp, left: Box<Expression>, right: Box<Expression>, }, Logical { op: LogicalOp, left: Box<Expression>, right: Box<Expression>, }, Assign { op: String, target: Box<Expression>, value: Box<Expression>, }, Conditional { test: Box<Expression>, consequent: Box<Expression>, alternate: Box<Expression>, }, Member { object: Box<Expression>, property: String, optional: bool, }, Index { object: Box<Expression>, index: Box<Expression>, optional: bool, }, Call { callee: Box<Expression>, arguments: Vec<Expression>, optional: bool, }, New { callee: Box<Expression>, arguments: Vec<Expression>, }, Spread(Box<Expression>), Class { name: Option<String>, superclass: Option<Box<Expression>>, members: Vec<ClassMember>, }, Super, Sequence(Vec<Expression>), NewTarget, Regex(String, String),
}

Variants§

§

Number(f64)

§

BigIntLit(String)

BigInt リテラル(数値部分の文字列。0x/0o/0b 接頭辞を含み得る)。

§

Str(String)

§

Bool(bool)

§

Null

§

Undefined

§

Identifier(String)

§

This

§

TemplateLiteral

Fields

§quasis: Vec<String>
§

TaggedTemplate

タグ付きテンプレート tag`...${e}...`(ES2015)。quasis/rawTemplateLiteral と同様 exprs より1つ多い。tag(strings, ...values) 呼出しで stringsquasis の配列に .rawraw の配列)を added property として持つ。

Fields

§quasis: Vec<String>
§

Array(Vec<Expression>)

§

Object(Vec<Property>)

§

Function

Fields

§params: Vec<Param>
§is_arrow: bool
§is_async: bool
§is_generator: bool
§

Await(Box<Expression>)

await expr

§

Yield

yield expr / yield* expr

Fields

§argument: Option<Box<Expression>>
§delegate: bool
§

Unary

Fields

§

Update

Fields

§prefix: bool
§target: Box<Expression>
§

Binary

Fields

§

Logical

§

Assign

Fields

§target: Box<Expression>
§

Conditional

Fields

§consequent: Box<Expression>
§alternate: Box<Expression>
§

Member

Fields

§object: Box<Expression>
§property: String
§optional: bool
§

Index

Fields

§object: Box<Expression>
§optional: bool
§

Call

Fields

§callee: Box<Expression>
§arguments: Vec<Expression>
§optional: bool
§

New

Fields

§callee: Box<Expression>
§arguments: Vec<Expression>
§

Spread(Box<Expression>)

スプレッド要素 ...expr(配列リテラル/呼出引数/オブジェクト内で展開される)。

§

Class

class 式/宣言。

Fields

§superclass: Option<Box<Expression>>
§members: Vec<ClassMember>
§

Super

supersuper(...) / super.x)。

§

Sequence(Vec<Expression>)

カンマ演算子 a, b, c。全要素を順に評価し、最後の値を返す (途中の要素の副作用も実行する。for(i=0,j=10; ...) 等で使われる)。

§

NewTarget

new.target(MetaProperty。new 経由の呼び出しではコンストラクタ関数自身、 通常呼び出しでは undefined)。

§

Regex(String, String)

正規表現リテラル /pattern/flags

Trait Implementations§

Source§

impl Clone for Expression

Source§

fn clone(&self) -> Expression

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 Expression

Source§

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

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

impl PartialEq for Expression

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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 Expression

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 = 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.