Home Reference Source Repository

References

Class Summary

Static Public Class Summary
public
`[ elements ]`
public
`[ a, b ] = ...`.
public
Like FunctionExpression but uses the `params => body` form.
public
`left operator right` Mutates an existing variable.
public
Just like a Property, but kind is always `init`.
public
`left operator right` Calls a binary operator.
public
A block statement, i.e., a sequence of statements surrounded by braces.
public
public
`callee(arguments)`
public
Must be *part* of a {@link TryStatement} -- does *not* follow it.
public
{@link ClassDeclaration} | {@link ClassExpression}
public
Contents of a {@link Class}.
public
{@link Class} in declaration position.
public
{@link Class} in expression position.
public
`test ? consequent : alternate`
public
The `continue` keyword.
public
The `debugger` keyword.
public
Line that declares new locals.
public
`do body while (test)`
public
An empty statement, i.e., a solitary semicolon.
public
`export * from source`
public
`export default declaration`
public
Exports multiple values as in `export { a, b as c }`.
public
A non-default export.
public
Code that has a value.
public
An expression statement, i.e., a statement consisting of a single expression.
public
`for (left in right) body`
public
`for (left of right) body`
public
`for (init; test; update) body` Not to be confused with ForInStatement or ForOfStatement.
public
FunctionDeclaration | FunctionExpression | ArrowFunctionExpression
public
{@link Function} in declaration position.
public
{@link Function} in expression position.
public
public
A JavaScript identifier.
public
An if (or if ...
public
`import specifiers from source` Only one specifier may be a ImportDefaultSpecifier.
public
The default export, as in `import a from "source"`.
public
Object of every export, as in `import * as a from "source"`.
public
A non-default import.
public
{@link ImportSpecifier} | {@link ImportDefaultSpecifier} | {@link ImportNamespaceSpecifier}
public
A statement prefixed by a label.
public
public

Loc

Range of text in the source string.
public
`left operator right` Calls a lazy logical operator.
public
If computed === true, `object[property]`.
public
Part of a {@link ClassBody}.
public
A specifier in an import or export declaration.
public
`new callee(arguments)` Just like {@link CallExpression} but with `new` in front.
public
Base type of all ASTs.
public
An object literal.
public
`{ a, b: c } =` Object deconstructing pattern.
public
Can go in a parameter list or on the left side of an assignment.
public

Pos

Represents a single location in the source string.
public
public
Part of an ObjectExpression.
public
Can be the last argument to a FunctionExpression/FunctionDeclaration or go at the end of an ArrayPattern.
public
The `return` keyword, optionally followed by an Expression to return.
public
`expressions[0], expressions[1], ...` Expression composed of other expressions, separated by the comma operator.
public
`...args` in a CallExpression.
public
Blocks of code have lines that are Statements or Declarations.
public
A single `case` within a SwitchStatement.
public
`switch (discriminant) { cases }` Only the last entry of `cases` is allowed to be `default`.
public
TemplateLiteral with a tag in front, like`this`.
public
Part of a TemplateLiteral.
public
A template with no tag.
public
The `this` keyword.
public
The `throw` keyword, and something to throw.
public
`try { block } catch (handler.param) { handler.body } finally { finalizer }` At least one of `handler` or `finalizer` must be non-null.
public
`operator argument` Calls a unary operator.
public
`++argument` or `argument++` Increments or decrements a number.
public
Declares and optionally initializes many variables.
public
Single declaration within a {@link VariableDeclaration}.
public
`while (test) body`
public
`yield argument` or `yield* argument`

Function Summary

Static Public Function Summary
public

fromObject(_: *): *

Converts a plain object to a {@link Node}.
public

functionExpressionThunk(body: *, generator: *): *

public
Mangles name and makes an {@link Identifier}.
public

loc(ast: Node, loc: Loc): *

Assigns `loc` to `ast` and returns it.
public
Convert a name to a valid JavaScript identifier.
public

member(object: Node, propertyName: string): MemberExpression

Creates a member expression for `propertyName` in `object`, using dot syntax (`a.b`) if possible, and falling back to `a['b']`.
public

needsMangle(name: *): *

`false` iff `name` is a valid JavaScript identifier.
public
An Identifier if propertyName is a valid JavaScript property name; otherwise a Literal string.
public

propertyNameOk(name: *): *

`true` iff `name` can be used as a property name using dot syntax (`a.b`).
public

render(ast: Node, options: object): *

Creates JavaScript source code from a {@link Node}.
public

renderWithSourceMap(ast: Node, inFilePath: string, outFilePath: string): code: string, sourceMap: string

Same as {@link render}, but with a source map as part of the output.
public

singleCharLoc(pos: Pos): *

Loc consisting of the character at `pos`.
public

toStatement(ast: *): *

Convert any {@link Node} into one that can be used as the content of a line.
public

unmangle(name: *): *

Undoes {@link mangleIdentifier}.

Variable Summary

Static Public Variable Summary
public
Accepted kinds of {@link AssignmentExpression}.
public
Accepted kinds of {@link BinaryExpression}.
public
Accepted kinds of {@link LogicalExpression}.
public
Accepted kinds of {@link MethodDefinition}.
public
Accepted kinds of {@link Property}.
public
Fist column number for a line; they start at 0.
public
First line number for a source string; they start at 1.
public
First {@link Pos} in a source string.
public
Accepted kinds of {@link UnaryExpression}.
public
Accepted kinds of {@link UpdateExpression}.
public
Accepted kinds of {@link VariableDeclaration}.
public
Set of JavaScript keywords.