README

dowdiness/js_engine/ast does not have a README file

#
BinOp

pub(all) enum BinOp {
Add
Sub
Mul
Div
Mod
EqEq
EqEqEq
NotEq
NotEqEq
Lt
Gt
LtEq
GtEq
And
Or
NullishCoalesce
BitAnd
BitOr
BitXor
LShift
RShift
URShift
Exp
In
Instanceof
} derive(Eq,
Debug
)

impl Show for BinOp

#
ClassField

pub(all) struct ClassField {
key : Expr
initializer : Expr?
computed : Bool
is_static : Bool
is_private : Bool
} derive(Eq,
Debug
)

impl Show for ClassField

#
ClassMember

pub(all) enum ClassMember {
Method(ClassMethod)
Field(ClassField)
StaticBlock(Array[Stmt],
Loc
)
} derive(Eq,
Debug
)

impl Show for ClassMember

#
ClassMethod

pub(all) struct ClassMethod {
key : Expr
value : Expr
kind : PropKind
computed : Bool
is_static : Bool
is_private : Bool
} derive(Eq,
Debug
)

impl Show for ClassMethod

#
CompoundOp

pub(all) enum CompoundOp {
AddAssign
SubAssign
MulAssign
DivAssign
ModAssign
ExpAssign
BitAndAssign
BitOrAssign
BitXorAssign
LShiftAssign
RShiftAssign
URShiftAssign
LogicalAndAssign
LogicalOrAssign
NullishAssign
} derive(Eq,
Debug
)

impl Show for CompoundOp

#
ExportSpecifier

pub(all) struct ExportSpecifier {
local_name : String
exported : String
} derive(Eq,
Debug
)

#
Expr

pub(all) enum Expr {
NumberLit(Double,
LexForm
,
Loc
)
StringLit(String, Bool,
LexForm
,
Loc
)
BoolLit(Bool,
Loc
)
NullLit(
Loc
)
UndefinedLit(
Loc
)
ArrayHole(
Loc
)
Ident(String,
Loc
)
Binary(BinOp, Expr, Expr,
Loc
)
Unary(UnaryOp, Expr,
Loc
)
Assign(String, Expr,
Loc
)
Call(Expr, Array[Expr],
Loc
)
Member(Expr, String,
Loc
)
Ternary(Expr, Expr, Expr,
Loc
)
FuncExpr(String?, Array[String], Array[Stmt],
Loc
, String?)
FuncExprExt(String?, Array[Param], String?, Array[Stmt],
Loc
, String?)
Grouping(Expr,
Loc
)
ObjectLit(Array[Property],
Loc
)
ArrayLit(Array[Expr],
Loc
)
ComputedMember(Expr, Expr,
Loc
)
MemberAssign(Expr, String, Expr,
Loc
)
PrivateMemberAssign(Expr, String, Expr,
Loc
)
ComputedAssign(Expr, Expr, Expr,
Loc
)
NewExpr(Expr, Array[Expr],
Loc
)
ThisExpr(
Loc
)
UpdateExpr(UpdateOp, Expr, Bool,
Loc
)
CompoundAssign(CompoundOp, Expr, Expr,
Loc
)
Comma(Expr, Expr,
Loc
)
TemplateLit(Array[(String, String?)], Array[Expr],
Loc
)
ArrowFunc(Array[String], Array[Stmt],
Loc
, String?)
ArrowFuncExt(Array[Param], String?, Array[Stmt],
Loc
, String?)
SpreadExpr(Expr,
Loc
)
RegexLit(String, String,
Loc
)
DestructureAssign(Pattern, Expr,
Loc
)
OptionalMember(Expr, String,
Loc
)
OptionalComputedMember(Expr, Expr,
Loc
)
OptionalCall(Expr, Array[Expr],
Loc
)
ChainMember(Expr, String,
Loc
)
ChainComputedMember(Expr, Expr,
Loc
)
ClassExpr(String?, Expr?, Array[ClassMember],
Loc
, String?)
SuperCall(Array[Expr],
Loc
)
SuperMember(String,
Loc
)
SuperComputedMember(Expr,
Loc
)
SuperMemberAssign(String, Expr,
Loc
)
SuperComputedAssign(Expr, Expr,
Loc
)
NewTargetExpr(
Loc
)
TaggedTemplate(Expr, Array[(String, String?)], Array[Expr],
Loc
)
GeneratorExpr(String?, Array[String], Array[Stmt],
Loc
, String?)
GeneratorExprExt(String?, Array[Param], String?, Array[Stmt],
Loc
, String?)
YieldExpr(Expr?, Bool,
Loc
)
AsyncFuncExpr(String?, Array[String], Array[Stmt],
Loc
, String?)
AsyncFuncExprExt(String?, Array[Param], String?, Array[Stmt],
Loc
, String?)
AsyncArrowFunc(Array[String], Array[Stmt],
Loc
, String?)
AsyncArrowFuncExt(Array[Param], String?, Array[Stmt],
Loc
, String?)
AsyncGeneratorExpr(String?, Array[String], Array[Stmt],
Loc
, String?)
AsyncGeneratorExprExt(String?, Array[Param], String?, Array[Stmt],
Loc
, String?)
AwaitExpr(Expr,
Loc
)
WebCompatCallAssign(Expr, Expr,
Loc
)
PrivateIdent(String,
Loc
)
PrivateMember(Expr, String,
Loc
)
} derive(Eq,
Debug
)

impl Show for Expr

#
ImportSpecifier

pub(all) struct ImportSpecifier {
local_name : String
imported : String
} derive(Eq,
Debug
)

#
Param

pub(all) struct Param {
name : String
default_val : Expr?
pattern : Pattern?
is_rest_pattern : Bool
} derive(Eq,
Debug
)

impl Show for Param

#
Pattern

pub(all) enum Pattern {
IdentPat(String)
ArrayPat(Array[Pattern?], Pattern?)
ObjectPat(Array[PropPat], Pattern?)
DefaultPat(Pattern, Expr)
AssignTarget(Expr)
} derive(Eq,
Debug
)

impl Show for Pattern

#
Program

pub(all) struct Program {
stmts : Array[Stmt]
} derive(Eq,
Debug
)

impl Show for Program

#
PropKind

pub(all) enum PropKind {
Init
Get
Set
Spread
} derive(Eq,
Debug
)

impl Show for PropKind

#
PropPat

pub(all) struct PropPat {
key : String
key_lex_form :
LexForm

key_loc :
Loc

value : Pattern
default_val : Expr?
computed_key : Expr?
} derive(Eq,
Debug
)

impl Show for PropPat

#
Property

pub(all) struct Property {
key : Expr
value : Expr
kind : PropKind
computed : Bool
is_method : Bool
} derive(Eq,
Debug
)

impl Show for Property

#
Stmt

pub(all) enum Stmt {
ExprStmt(Expr,
Loc
)
VarDecl(VarKind, String, Expr?,
Loc
)
Block(Array[Stmt],
Loc
)
StmtList(Array[Stmt],
Loc
)
IfStmt(Expr, Stmt, Stmt?,
Loc
)
WhileStmt(Expr, Stmt,
Loc
)
ForStmt(Stmt?, Expr?, Expr?, Stmt,
Loc
)
FuncDecl(String, Array[String], Array[Stmt],
Loc
, String?)
FuncDeclExt(String, Array[Param], String?, Array[Stmt],
Loc
, String?)
ReturnStmt(Expr?,
Loc
)
BreakStmt(String?,
Loc
)
ContinueStmt(String?,
Loc
)
ThrowStmt(Expr,
Loc
)
TryCatchStmt(Array[Stmt], Pattern?, Array[Stmt]?, Array[Stmt]?,
Loc
)
SwitchStmt(Expr, Array[SwitchCase],
Loc
)
DoWhileStmt(Stmt, Expr,
Loc
)
ForInStmt(VarKind?, String, Expr, Stmt,
Loc
)
ForOfStmt(VarKind?, String, Expr, Stmt,
Loc
)
ForInStmtPat(VarKind?, Pattern, Expr, Stmt,
Loc
)
ForOfStmtPat(VarKind?, Pattern, Expr, Stmt,
Loc
)
ForInExpr(Expr, Expr, Stmt,
Loc
)
ForOfExpr(Expr, Expr, Stmt,
Loc
)
AsyncForOfStmt(VarKind?, String, Expr, Stmt,
Loc
)
AsyncForOfStmtPat(VarKind?, Pattern, Expr, Stmt,
Loc
)
AsyncForOfExpr(Expr, Expr, Stmt,
Loc
)
DestructureDecl(VarKind, Pattern, Expr,
Loc
)
LabeledStmt(String, Stmt,
Loc
)
GeneratorDecl(String, Array[String], Array[Stmt],
Loc
, String?)
GeneratorDeclExt(String, Array[Param], String?, Array[Stmt],
Loc
, String?)
AsyncFuncDecl(String, Array[String], Array[Stmt],
Loc
, String?)
AsyncFuncDeclExt(String, Array[Param], String?, Array[Stmt],
Loc
, String?)
AsyncGeneratorDecl(String, Array[String], Array[Stmt],
Loc
, String?)
AsyncGeneratorDeclExt(String, Array[Param], String?, Array[Stmt],
Loc
, String?)
ClassDecl(String, Expr?, Array[ClassMember],
Loc
, String?)
WithStmt(Expr, Stmt,
Loc
)
ImportDecl(String?, Array[ImportSpecifier], String?, String,
LexForm
,
Loc
)
ExportNamedDecl(Stmt?, Array[ExportSpecifier], String?,
LexForm
,
Loc
)
ExportDefaultDecl(Expr,
Loc
)
ExportAllDecl(String?, String,
LexForm
,
Loc
)
} derive(Eq,
Debug
)

impl Show for Stmt

#
SwitchCase

pub(all) struct SwitchCase {
condition : Expr?
body : Array[Stmt]
} derive(Eq,
Debug
)

impl Show for SwitchCase

#
UnaryOp

pub(all) enum UnaryOp {
Neg
Pos
Not
Typeof
Void
Delete
BitNot
} derive(Eq,
Debug
)

impl Show for UnaryOp

#
UpdateOp

pub(all) enum UpdateOp {
Increment
Decrement
} derive(Eq,
Debug
)

impl Show for UpdateOp

#
VarKind

pub(all) enum VarKind {
LetKind
ConstKind
VarKind
} derive(Eq,
Debug
)

impl Show for VarKind

#
expr_immediate_children_any

fn expr_immediate_children_any(expr : Expr, visit : (Expr) -> Bool) -> Bool

Returns whether any immediate expression child of expr satisfies visit.

Immediate children are the expression-valued edges represented directly by the expression node: operands, arguments, literal elements and properties, template substitutions, destructuring RHS expressions, and a class's superclass. Function bodies, parameter lists, static blocks, and class member containers are not edges of this traversal. In particular, ClassExpr emits only its optional superclass; consumers with class-specific policies must handle class members locally.

The node itself is not passed to visit, and this function never recurses. Children are visited left-to-right and stop at the first true result.

#
pattern_immediate_children_any

fn pattern_immediate_children_any(pattern : Pattern, visit_pattern : (Pattern) -> Bool, visit_expr : (Expr) -> Bool) -> Bool

Returns whether any immediate pattern child of pattern satisfies visit_pattern or any embedded expression child satisfies visit_expr.

Immediate pattern children are nested patterns, array/rest elements, object/rest values, and assignment targets. Embedded expression edges are object computed keys and defaults, pattern defaults, and assignment-target expressions. Children are visited in source order, left-to-right, and stop at the first true result. This function never recurses and allocates no child collection.