AST

AST

new AST()

The AST builder class

Properties:
Name Type Description
withPositions Boolean

Should locate any node (by default false)

withSource Boolean

Should extract the node original code (by default false)

Source:
Tutorials:

Methods

prepare(kind, parser) → {function}

Prepares an AST node

Parameters:
Name Type Description
kind String | null

Defines the node type (if null, the kind must be passed at the function call)

parser Parser

The parser instance (use for extracting locations)

Source:

resolveLocations()

Includes locations from first & last into the target

Source:

resolvePrecedence()

Check and fix precence, by default using right

Source:

swapLocations()

Change parent node informations after swapping childs

Source: