Enum resast::expr::Expr[][src]

pub enum Expr<'a> {
Show 25 variants Array(ArrayExpr<'a>), ArrowFunc(ArrowFuncExpr<'a>), ArrowParamPlaceHolder(Vec<FuncArg<'a>>, bool), Assign(AssignExpr<'a>), Await(Box<Expr<'a>>), Binary(BinaryExpr<'a>), Class(Class<'a>), Call(CallExpr<'a>), Conditional(ConditionalExpr<'a>), Func(Func<'a>), Ident(Ident<'a>), Lit(Lit<'a>), Logical(LogicalExpr<'a>), Member(MemberExpr<'a>), MetaProp(MetaProp<'a>), New(NewExpr<'a>), Obj(ObjExpr<'a>), Sequence(SequenceExpr<'a>), Spread(Box<Expr<'a>>), Super, TaggedTemplate(TaggedTemplateExpr<'a>), This, Unary(UnaryExpr<'a>), Update(UpdateExpr<'a>), Yield(YieldExpr<'a>),
}
Expand description

A slightly more granular program part that a statement

Variants

Array(ArrayExpr<'a>)

Tuple Fields

0: ArrayExpr<'a>

[0,,]

ArrowFunc(ArrowFuncExpr<'a>)

Tuple Fields

An arrow function

() => console.log();
x => {
    return x;
}

ArrowParamPlaceHolder(Vec<FuncArg<'a>>, bool)

Tuple Fields

0: Vec<FuncArg<'a>>
1: bool

Used for resolving possible sequence expressions that are arrow parameters

Assign(AssignExpr<'a>)

Tuple Fields

0: AssignExpr<'a>

Assignment or update assignment

a = 0
b += 1

Await(Box<Expr<'a>>)

Tuple Fields

0: Box<Expr<'a>>

The await keyword followed by another Expr

Binary(BinaryExpr<'a>)

Tuple Fields

0: BinaryExpr<'a>

An operation that has two arguments

Class(Class<'a>)

Tuple Fields

0: Class<'a>

A class expression see Class

Call(CallExpr<'a>)

Tuple Fields

0: CallExpr<'a>

Calling a function or method

Conditional(ConditionalExpr<'a>)

Tuple Fields

A ternery expression

Func(Func<'a>)

Tuple Fields

0: Func<'a>

see Function

Ident(Ident<'a>)

Tuple Fields

0: Ident<'a>

An identifier

Lit(Lit<'a>)

Tuple Fields

0: Lit<'a>

A literal value, see Literal

Logical(LogicalExpr<'a>)

Tuple Fields

0: LogicalExpr<'a>

A specialized BinaryExpr for logical evaluation

true && true
false || true

Member(MemberExpr<'a>)

Tuple Fields

0: MemberExpr<'a>

Accessing the member of a value

b['thing'];
c.stuff;

MetaProp(MetaProp<'a>)

Tuple Fields

0: MetaProp<'a>

currently just new.target

New(NewExpr<'a>)

Tuple Fields

0: NewExpr<'a>
var a = true ? 'stuff' : 'things';

{} Calling a constructor

Obj(ObjExpr<'a>)

Tuple Fields

0: ObjExpr<'a>

Sequence(SequenceExpr<'a>)

Tuple Fields

0: SequenceExpr<'a>

Any sequence of expressions separated with a comma

Spread(Box<Expr<'a>>)

Tuple Fields

0: Box<Expr<'a>>

... followed by an Expr

Super

super

TaggedTemplate(TaggedTemplateExpr<'a>)

Tuple Fields

A template literal preceded by a tag function identifier

This

this

Unary(UnaryExpr<'a>)

Tuple Fields

0: UnaryExpr<'a>

An operation that has one argument

typeof 'a';
+9;

Update(UpdateExpr<'a>)

Tuple Fields

0: UpdateExpr<'a>

Increment or decrement

1++
--2

Yield(YieldExpr<'a>)

Tuple Fields

0: YieldExpr<'a>

yield a value from inside of a generator function

Implementations

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

Performs the conversion.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.