Expand description

AST builder DSL AST builder DSL

Re-exports

pub use super::BinOp;

Structs

An AST DSL helper to enable Program::try_from(with(|ctx| Ok(...))) via with

Functions

make a BinaryExpression (left, BinOp::Plus, right)

make an ArrayExpression (vec![v1, v2, ...]) (JS: [v1, v2, ...])

make a BinaryExpression(left, op, right)

Creates a BlockStatement from a closure that builds a vector of Statements.

make a CallExpression with callee and arguments (JS: callee(arguments...))

make an empty ArrayExpression, JS: []

make an empty ObjectExpression (JS: {})

make a BinaryExpression (left, BinOp::EqEq, right)

make an Identifier from name (JS: name)

make a computed MemberExpression(object, attr) (JS: object[attr])

make a Literal from value

make a non-computed (i.e. object.attr) MemberExpression(object, attr)

make a BinaryExpression (left, BinOp::Star, right)

make a Literal (JSON::Null) (JS: null).

make a ObjectExpression (vec![(k1, v1), ...]) (JS: {k1: v1, ...})

Creates a Program from a list of Statements.

make a BinaryExpression (left, BinOp::Minus, right)

A helper to surround an closure in assert_parse! macro calls.

Type Definitions

An AST DSL helper to enable Program::try_from(block(|ctx| Ok(...))) via block