How to use the @webassemblyjs/helper-flatten-ast.flatten function in @webassemblyjs/helper-flatten-ast

To help you get started, we’ve selected a few @webassemblyjs/helper-flatten-ast examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github xtuc / webassemblyjs / packages / helper-compiler / src / index.js View on Github external
export function toIR(ast: Program): IR {
  const program = {};
  const funcTable = [];

  // flatten the ast first
  // TODO(sven): do it in a single pass?

  const module = new Module(ast);

  traverse(ast, {
    Start({ node }: NodePath) {
      const { name, startAt } = module.emitStartFunc(

      funcTable.push({ name, startAt });

    Func(funcPath: NodePath) {

      traverse(funcPath.node, {


Flatten an AST helper

Latest version published 2 months ago

Package Health Score

76 / 100
Full package analysis

Popular @webassemblyjs/helper-flatten-ast functions

Similar packages