Enum parse_js::ast::Syntax

source ·
pub enum Syntax<'a> {
Show 65 variants IdentifierPattern { name: SourceRange<'a>, }, ArrayPattern { elements: SessionVec<'a, Option<ArrayPatternElement<'a>>>, rest: Option<Node<'a>>, }, ObjectPattern { properties: SessionVec<'a, Node<'a>>, rest: Option<Node<'a>>, }, ClassOrFunctionName { name: SourceRange<'a>, }, FunctionSignature { parameters: SessionVec<'a, Node<'a>>, }, ClassDecl { export: bool, export_default: bool, name: Option<Node<'a>>, extends: Option<Node<'a>>, members: SessionVec<'a, ClassMember<'a>>, }, FunctionDecl { export: bool, export_default: bool, generator: bool, is_async: bool, name: Option<Node<'a>>, signature: Node<'a>, body: Node<'a>, }, ParamDecl { rest: bool, pattern: Node<'a>, default_value: Option<Node<'a>>, }, VarDecl { export: bool, mode: VarDeclMode, declarators: SessionVec<'a, VariableDeclarator<'a>>, }, ArrowFunctionExpr { parenthesised: bool, is_async: bool, signature: Node<'a>, body: Node<'a>, }, BinaryExpr { parenthesised: bool, operator: OperatorName, left: Node<'a>, right: Node<'a>, }, CallExpr { optional_chaining: bool, parenthesised: bool, callee: Node<'a>, arguments: SessionVec<'a, Node<'a>>, }, ClassExpr { parenthesised: bool, name: Option<Node<'a>>, extends: Option<Node<'a>>, members: SessionVec<'a, ClassMember<'a>>, }, ConditionalExpr { parenthesised: bool, test: Node<'a>, consequent: Node<'a>, alternate: Node<'a>, }, ComputedMemberExpr { assignment_target: bool, optional_chaining: bool, object: Node<'a>, member: Node<'a>, }, FunctionExpr { parenthesised: bool, is_async: bool, generator: bool, name: Option<Node<'a>>, signature: Node<'a>, body: Node<'a>, }, IdentifierExpr { name: SourceRange<'a>, }, ImportExpr { module: Node<'a>, }, ImportMeta {}, JsxAttribute { name: Node<'a>, value: Option<Node<'a>>, }, JsxElement { name: Option<Node<'a>>, attributes: SessionVec<'a, Node<'a>>, children: SessionVec<'a, Node<'a>>, }, JsxExpressionContainer { value: Node<'a>, }, JsxMemberExpression { base: Node<'a>, path: SessionVec<'a, SourceRange<'a>>, }, JsxName { namespace: Option<SourceRange<'a>>, name: SourceRange<'a>, }, JsxSpreadAttribute { value: Node<'a>, }, JsxText { value: SourceRange<'a>, }, LiteralArrayExpr { elements: SessionVec<'a, ArrayElement<'a>>, }, LiteralBigIntExpr { value: SessionString<'a>, }, LiteralBooleanExpr { value: bool, }, LiteralNull {}, LiteralNumberExpr { value: JsNumber, }, LiteralObjectExpr { members: SessionVec<'a, Node<'a>>, }, LiteralRegexExpr {}, LiteralStringExpr { value: &'a str, }, LiteralTemplateExpr { parts: SessionVec<'a, LiteralTemplatePart<'a>>, }, MemberExpr { parenthesised: bool, optional_chaining: bool, assignment_target: bool, left: Node<'a>, right: SourceRange<'a>, }, SuperExpr {}, ThisExpr {}, UnaryExpr { parenthesised: bool, operator: OperatorName, argument: Node<'a>, }, UnaryPostfixExpr { parenthesised: bool, operator: OperatorName, argument: Node<'a>, }, BlockStmt { body: SessionVec<'a, Node<'a>>, }, BreakStmt { label: Option<SourceRange<'a>>, }, ContinueStmt { label: Option<SourceRange<'a>>, }, DebuggerStmt {}, DoWhileStmt { condition: Node<'a>, body: Node<'a>, }, EmptyStmt {}, ExportDefaultExprStmt { expression: Node<'a>, }, ExportListStmt { names: ExportNames<'a>, from: Option<&'a str>, }, ExpressionStmt { expression: Node<'a>, }, IfStmt { test: Node<'a>, consequent: Node<'a>, alternate: Option<Node<'a>>, }, ImportStmt { default: Option<Node<'a>>, names: Option<ExportNames<'a>>, module: &'a str, }, ForStmt { header: ForStmtHeader<'a>, body: Node<'a>, }, LabelStmt { name: SourceRange<'a>, statement: Node<'a>, }, ReturnStmt { value: Option<Node<'a>>, }, SwitchStmt { test: Node<'a>, branches: SessionVec<'a, Node<'a>>, }, ThrowStmt { value: Node<'a>, }, TryStmt { wrapped: Node<'a>, catch: Option<Node<'a>>, finally: Option<Node<'a>>, }, WhileStmt { condition: Node<'a>, body: Node<'a>, }, TopLevel { body: SessionVec<'a, Node<'a>>, }, CallArg { spread: bool, value: Node<'a>, }, CatchBlock { parameter: Option<Node<'a>>, body: Node<'a>, }, ObjectMember { typ: ObjectMemberType<'a>, }, ObjectPatternProperty { key: ClassOrObjectMemberKey<'a>, target: Node<'a>, shorthand: bool, default_value: Option<Node<'a>>, }, SwitchBranch { case: Option<Node<'a>>, body: SessionVec<'a, Node<'a>>, }, _TakenNode {},
}

Variants§

§

IdentifierPattern

Fields

§name: SourceRange<'a>
§

ArrayPattern

Fields

§rest: Option<Node<'a>>
§

ObjectPattern

Fields

§properties: SessionVec<'a, Node<'a>>
§rest: Option<Node<'a>>
§

ClassOrFunctionName

Fields

§name: SourceRange<'a>
§

FunctionSignature

Fields

§parameters: SessionVec<'a, Node<'a>>
§

ClassDecl

Fields

§export: bool
§export_default: bool
§name: Option<Node<'a>>
§extends: Option<Node<'a>>
§members: SessionVec<'a, ClassMember<'a>>
§

FunctionDecl

Fields

§export: bool
§export_default: bool
§generator: bool
§is_async: bool
§name: Option<Node<'a>>
§signature: Node<'a>
§body: Node<'a>
§

ParamDecl

Fields

§rest: bool
§pattern: Node<'a>
§default_value: Option<Node<'a>>
§

VarDecl

Fields

§export: bool
§declarators: SessionVec<'a, VariableDeclarator<'a>>
§

ArrowFunctionExpr

Fields

§parenthesised: bool
§is_async: bool
§signature: Node<'a>
§body: Node<'a>
§

BinaryExpr

Fields

§parenthesised: bool
§operator: OperatorName
§left: Node<'a>
§right: Node<'a>
§

CallExpr

Fields

§optional_chaining: bool
§parenthesised: bool
§callee: Node<'a>
§arguments: SessionVec<'a, Node<'a>>
§

ClassExpr

Fields

§parenthesised: bool
§name: Option<Node<'a>>
§extends: Option<Node<'a>>
§members: SessionVec<'a, ClassMember<'a>>
§

ConditionalExpr

Fields

§parenthesised: bool
§test: Node<'a>
§consequent: Node<'a>
§alternate: Node<'a>
§

ComputedMemberExpr

Fields

§assignment_target: bool

Set to true if this MemberExpr is the LHS of an assignment expression.

§optional_chaining: bool
§object: Node<'a>
§member: Node<'a>
§

FunctionExpr

Fields

§parenthesised: bool
§is_async: bool
§generator: bool
§name: Option<Node<'a>>
§signature: Node<'a>
§body: Node<'a>
§

IdentifierExpr

Fields

§name: SourceRange<'a>
§

ImportExpr

Fields

§module: Node<'a>
§

ImportMeta

§

JsxAttribute

Fields

§name: Node<'a>
§value: Option<Node<'a>>
§

JsxElement

Fields

§name: Option<Node<'a>>
§attributes: SessionVec<'a, Node<'a>>
§children: SessionVec<'a, Node<'a>>
§

JsxExpressionContainer

Fields

§value: Node<'a>
§

JsxMemberExpression

Fields

§base: Node<'a>
§path: SessionVec<'a, SourceRange<'a>>
§

JsxName

Fields

§namespace: Option<SourceRange<'a>>
§name: SourceRange<'a>
§

JsxSpreadAttribute

Fields

§value: Node<'a>
§

JsxText

Fields

§value: SourceRange<'a>
§

LiteralArrayExpr

Fields

§elements: SessionVec<'a, ArrayElement<'a>>
§

LiteralBigIntExpr

Fields

§value: SessionString<'a>
§

LiteralBooleanExpr

Fields

§value: bool
§

LiteralNull

§

LiteralNumberExpr

Fields

§value: JsNumber
§

LiteralObjectExpr

Fields

§members: SessionVec<'a, Node<'a>>
§

LiteralRegexExpr

§

LiteralStringExpr

Fields

§value: &'a str
§

LiteralTemplateExpr

Fields

§

MemberExpr

Fields

§parenthesised: bool
§optional_chaining: bool
§assignment_target: bool

Set to true if this MemberExpr is the LHS of an assignment expression.

§left: Node<'a>
§right: SourceRange<'a>
§

SuperExpr

§

ThisExpr

§

UnaryExpr

Fields

§parenthesised: bool
§operator: OperatorName
§argument: Node<'a>
§

UnaryPostfixExpr

Fields

§parenthesised: bool
§operator: OperatorName
§argument: Node<'a>
§

BlockStmt

Fields

§body: SessionVec<'a, Node<'a>>
§

BreakStmt

Fields

§label: Option<SourceRange<'a>>
§

ContinueStmt

Fields

§label: Option<SourceRange<'a>>
§

DebuggerStmt

§

DoWhileStmt

Fields

§condition: Node<'a>
§body: Node<'a>
§

EmptyStmt

§

ExportDefaultExprStmt

Fields

§expression: Node<'a>
§

ExportListStmt

Fields

§names: ExportNames<'a>
§from: Option<&'a str>
§

ExpressionStmt

Fields

§expression: Node<'a>
§

IfStmt

Fields

§test: Node<'a>
§consequent: Node<'a>
§alternate: Option<Node<'a>>
§

ImportStmt

Fields

§default: Option<Node<'a>>
§names: Option<ExportNames<'a>>
§module: &'a str
§

ForStmt

Fields

§header: ForStmtHeader<'a>
§body: Node<'a>
§

LabelStmt

Fields

§name: SourceRange<'a>
§statement: Node<'a>
§

ReturnStmt

Fields

§value: Option<Node<'a>>
§

SwitchStmt

Fields

§test: Node<'a>
§branches: SessionVec<'a, Node<'a>>
§

ThrowStmt

Fields

§value: Node<'a>
§

TryStmt

Fields

§wrapped: Node<'a>
§catch: Option<Node<'a>>
§finally: Option<Node<'a>>
§

WhileStmt

Fields

§condition: Node<'a>
§body: Node<'a>
§

TopLevel

Fields

§body: SessionVec<'a, Node<'a>>
§

CallArg

Fields

§spread: bool
§value: Node<'a>
§

CatchBlock

Fields

§parameter: Option<Node<'a>>
§body: Node<'a>
§

ObjectMember

Fields

§

ObjectPatternProperty

Fields

§target: Node<'a>
§shorthand: bool
§default_value: Option<Node<'a>>
§

SwitchBranch

Fields

§case: Option<Node<'a>>
§body: SessionVec<'a, Node<'a>>
§

_TakenNode

Trait Implementations§

source§

impl<'a> Debug for Syntax<'a>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for Syntax<'a>

§

impl<'a> !Send for Syntax<'a>

§

impl<'a> !Sync for Syntax<'a>

§

impl<'a> Unpin for Syntax<'a>

§

impl<'a> !UnwindSafe for Syntax<'a>

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> 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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.