pub struct Expr {
pub kind: ExprKind,
pub span: Span,
pub op_pos: Option<Position>,
}Expand description
An expression.
Fields§
§kind: ExprKindExpression payload.
span: SpanSource range.
op_pos: Option<Position>Where the operator or punctuator that produced this node sits.
Stack traces report the position of the token that failed, not the start of
the enclosing expression: 1 + null[0] blames the [, and o.foo = 1 blames
the .. span.start cannot stand in for it — the base expression starts
earlier — so the parser records the token here for the node kinds that emit an
instruction at an operator, and the compiler puts it in the position table.
Implementations§
Source§impl Expr
impl Expr
Sourcepub fn at_operator(kind: ExprKind, span: Span, pos: Position) -> Expr
pub fn at_operator(kind: ExprKind, span: Span, pos: Position) -> Expr
Build an expression node whose failing instruction sits at pos.
Sourcepub fn is_anonymous_function_definition(&self) -> bool
pub fn is_anonymous_function_definition(&self) -> bool
Whether this expression is an anonymous function definition, which takes
its name from the binding it is assigned to (var f = function(){}).
Trait Implementations§
impl StructuralPartialEq for Expr
Auto Trait Implementations§
impl Forget for Expr
impl Freeze for Exprwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<Option<ArrayElement>>: Freeze,
PhantomData<ObjectProperty>: Freeze,
*const Function is !null: Freeze,
PhantomData<Function>: Freeze,
*const Class is !null: Freeze,
PhantomData<Class>: Freeze,
*const TemplateLiteral is !null: Freeze,
PhantomData<TemplateLiteral>: Freeze,
*const Expr is !null: Freeze,
PhantomData<Expr>: Freeze,
*const Pattern is !null: Freeze,
PhantomData<Pattern>: Freeze,
impl Move for Expr
impl RefUnwindSafe for Expr
impl Send for Expr
impl Sync for Expr
impl Unpin for Expr
impl UnsafeUnpin for Exprwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<Option<ArrayElement>>: UnsafeUnpin,
PhantomData<ObjectProperty>: UnsafeUnpin,
*const Function is !null: UnsafeUnpin,
PhantomData<Function>: UnsafeUnpin,
*const Class is !null: UnsafeUnpin,
PhantomData<Class>: UnsafeUnpin,
*const TemplateLiteral is !null: UnsafeUnpin,
PhantomData<TemplateLiteral>: UnsafeUnpin,
*const Expr is !null: UnsafeUnpin,
PhantomData<Expr>: UnsafeUnpin,
*const Pattern is !null: UnsafeUnpin,
PhantomData<Pattern>: UnsafeUnpin,
impl UnwindSafe for Exprwhere
RawVecInner: UnwindSafe,
BoxRaw<Expr>: UnwindSafe,
BoxRaw<Function>: UnwindSafe,
BoxRaw<Class>: UnwindSafe,
BoxRaw<TemplateLiteral>: UnwindSafe,
BoxRaw<Pattern>: UnwindSafe,
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