Enum dprint_swc_ecma_ast_view::Expr
source · [−]pub enum Expr<'a> {
Show 37 variants
This(&'a ThisExpr<'a>),
Array(&'a ArrayLit<'a>),
Object(&'a ObjectLit<'a>),
Fn(&'a FnExpr<'a>),
Unary(&'a UnaryExpr<'a>),
Update(&'a UpdateExpr<'a>),
Bin(&'a BinExpr<'a>),
Assign(&'a AssignExpr<'a>),
Member(&'a MemberExpr<'a>),
SuperProp(&'a SuperPropExpr<'a>),
Cond(&'a CondExpr<'a>),
Call(&'a CallExpr<'a>),
New(&'a NewExpr<'a>),
Seq(&'a SeqExpr<'a>),
Ident(&'a Ident<'a>),
Lit(Lit<'a>),
Tpl(&'a Tpl<'a>),
TaggedTpl(&'a TaggedTpl<'a>),
Arrow(&'a ArrowExpr<'a>),
Class(&'a ClassExpr<'a>),
Yield(&'a YieldExpr<'a>),
MetaProp(&'a MetaPropExpr<'a>),
Await(&'a AwaitExpr<'a>),
Paren(&'a ParenExpr<'a>),
JSXMember(&'a JSXMemberExpr<'a>),
JSXNamespacedName(&'a JSXNamespacedName<'a>),
JSXEmpty(&'a JSXEmptyExpr<'a>),
JSXElement(&'a JSXElement<'a>),
JSXFragment(&'a JSXFragment<'a>),
TsTypeAssertion(&'a TsTypeAssertion<'a>),
TsConstAssertion(&'a TsConstAssertion<'a>),
TsNonNull(&'a TsNonNullExpr<'a>),
TsAs(&'a TsAsExpr<'a>),
TsInstantiation(&'a TsInstantiation<'a>),
PrivateName(&'a PrivateName<'a>),
OptChain(&'a OptChainExpr<'a>),
Invalid(&'a Invalid<'a>),
}
Variants
This(&'a ThisExpr<'a>)
Array(&'a ArrayLit<'a>)
Object(&'a ObjectLit<'a>)
Fn(&'a FnExpr<'a>)
Unary(&'a UnaryExpr<'a>)
Update(&'a UpdateExpr<'a>)
++v
, --v
, v++
, v--
Bin(&'a BinExpr<'a>)
Assign(&'a AssignExpr<'a>)
Member(&'a MemberExpr<'a>)
A member expression. If computed is true, the node corresponds to a computed (a[b]) member expression and property is an Expression. If computed is false, the node corresponds to a static (a.b) member expression and property is an Identifier.
SuperProp(&'a SuperPropExpr<'a>)
Cond(&'a CondExpr<'a>)
true ? ‘a’ : ‘b’
Call(&'a CallExpr<'a>)
New(&'a NewExpr<'a>)
new Cat()
Seq(&'a SeqExpr<'a>)
Ident(&'a Ident<'a>)
Lit(Lit<'a>)
Tpl(&'a Tpl<'a>)
TaggedTpl(&'a TaggedTpl<'a>)
Arrow(&'a ArrowExpr<'a>)
Class(&'a ClassExpr<'a>)
Yield(&'a YieldExpr<'a>)
MetaProp(&'a MetaPropExpr<'a>)
Await(&'a AwaitExpr<'a>)
Paren(&'a ParenExpr<'a>)
JSXMember(&'a JSXMemberExpr<'a>)
JSXNamespacedName(&'a JSXNamespacedName<'a>)
JSXEmpty(&'a JSXEmptyExpr<'a>)
JSXElement(&'a JSXElement<'a>)
JSXFragment(&'a JSXFragment<'a>)
TsTypeAssertion(&'a TsTypeAssertion<'a>)
TsConstAssertion(&'a TsConstAssertion<'a>)
TsNonNull(&'a TsNonNullExpr<'a>)
TsAs(&'a TsAsExpr<'a>)
TsInstantiation(&'a TsInstantiation<'a>)
PrivateName(&'a PrivateName<'a>)
OptChain(&'a OptChainExpr<'a>)
Invalid(&'a Invalid<'a>)
Implementations
sourceimpl<'a> Expr<'a>
impl<'a> Expr<'a>
pub fn to<T: CastableNode<'a>>(&self) -> Option<&'a T>
pub fn expect<T: CastableNode<'a>>(&self) -> &'a T
pub fn is<T: CastableNode<'a>>(&self) -> bool
Trait Implementations
sourceimpl<'a> NodeTrait<'a> for Expr<'a>
impl<'a> NodeTrait<'a> for Expr<'a>
fn parent(&self) -> Option<Node<'a>>
fn children(&self) -> Vec<Node<'a>>
fn as_node(&self) -> Node<'a>
fn kind(&self) -> NodeKind
fn ancestors(&self) -> AncestorIterator<'a>ⓘNotable traits for AncestorIterator<'a>impl<'a> Iterator for AncestorIterator<'a> type Item = Node<'a>;
fn start_line(&self) -> usize
fn end_line(&self) -> usize
fn start_column(&self) -> usize
fn end_column(&self) -> usize
fn width(&self) -> usize
fn child_index(&self) -> usize
fn previous_sibling(&self) -> Option<Node<'a>>
sourcefn previous_siblings(&self) -> Vec<Node<'a>>
fn previous_siblings(&self) -> Vec<Node<'a>>
Gets the previous siblings in the order they appear in the file.
sourcefn next_sibling(&self) -> Option<Node<'a>>
fn next_sibling(&self) -> Option<Node<'a>>
Gets the next siblings in the order they appear in the file.
fn next_siblings(&self) -> Vec<Node<'a>>
fn tokens(&self) -> &'a [TokenAndSpan]
fn children_with_tokens(&self) -> Vec<NodeOrToken<'a>>
fn children_with_tokens_fast(
&self,
program: &dyn RootNode<'a>
) -> Vec<NodeOrToken<'a>>
fn leading_comments(&self) -> CommentsIterator<'a>ⓘNotable traits for CommentsIterator<'a>impl<'a> Iterator for CommentsIterator<'a> type Item = &'a Comment;
fn trailing_comments(&self) -> CommentsIterator<'a>ⓘNotable traits for CommentsIterator<'a>impl<'a> Iterator for CommentsIterator<'a> type Item = &'a Comment;
sourcefn module(&self) -> &Module<'a>
fn module(&self) -> &Module<'a>
Gets the root node if the view was created from a Module; otherwise panics.
sourcefn script(&self) -> &Script<'a>
fn script(&self) -> &Script<'a>
Gets the root node if the view was created from a Script; otherwise panics.
fn text(&self) -> &'a str
fn previous_token(&self) -> Option<&'a TokenAndSpan>
fn next_token(&self) -> Option<&'a TokenAndSpan>
sourcefn previous_tokens(&self) -> &'a [TokenAndSpan]
fn previous_tokens(&self) -> &'a [TokenAndSpan]
Gets the previous tokens in the order they appear in the file.
sourcefn next_tokens(&self) -> &'a [TokenAndSpan]
fn next_tokens(&self) -> &'a [TokenAndSpan]
Gets the next tokens in the order they appear in the file.
impl<'a> Copy for Expr<'a>
Auto Trait Implementations
impl<'a> !RefUnwindSafe for Expr<'a>
impl<'a> !Send for Expr<'a>
impl<'a> !Sync for Expr<'a>
impl<'a> Unpin for Expr<'a>
impl<'a> !UnwindSafe for Expr<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more