Class default

The Transformer class extends the TransformVisitor class from visitor-as and overrides its methods to perform custom transformations on the AST during the compilation process. It looks for specific function calls or decorators and replaces them with new expressions or functions as needed.

Hierarchy

  • TransformVisitor
    • default

Constructors

  • Returns default

Methods

  • Performs transformations on the AST after the parser completes. It visits each source file, checks for updates, performs transformations, and writes the transformed code to a new file in the build directory.

    Parameters

    • parser: Parser

      A Parser object.

    Returns void

  • Visits a call expression node, checks if it matches any registered transformer patterns from callTransformers, and if so, transforms it.

    Parameters

    • node: CallExpression

      A CallExpression to visit.

    Returns Expression

    The transformed node if its call expression matches a transformer pattern, otherwise the original node.

  • Visits function declarations and calls transformers if their matching patterns are passing on the node.

    Parameters

    • node: FunctionDeclaration

      A FunctionDeclaration node to visit.

    Returns FunctionDeclaration

    The transformer node.

Generated using TypeDoc