Expand description
JavaScript abstract syntax tree.
Every node here has a direct lowering in compiler.rs. JS is
statement-oriented with brace-delimited blocks, so the tree separates Stmt
(blocks of these form a program/function body) from Expr. Numbers are all
IEEE-754 f64, matching JavaScript’s single number type.
Structs§
- Class
Member - One member of a class body: a method, accessor, or field, on the instance or static side.
- Class
Node - A
classdeclaration/expression body. - Declarator
- A single declarator inside a
var/let/const. - Param
- A formal parameter.
- Stmt
- A statement plus its 1-based source line.
- Switch
Case - One
case/defaultclause of aswitch.
Enums§
- BinOp
- A binary operator (
a <op> b).&&/||/??areLogicalOpbecause they short-circuit and yield an operand value, not a coerced boolean. - Decl
Kind - The kind of a variable declaration.
- Expr
- A JavaScript expression.
- FnBody
- A function/arrow body: either a brace-delimited statement list or (arrow) a single expression whose value is returned.
- Logical
Op - A short-circuiting logical operator.
- Member
Kind - The kind of a class member.
- Prop
- A property of an object literal.
- Stmt
Kind - A JavaScript statement.
- UnOp
- A unary prefix operator.
- Update
Op - The update (increment/decrement) operator, prefix or postfix.