How to use @webassemblyjs/helper-flatten-ast - 1 common examples

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?
  flatten(ast);

  const module = new Module(ast);

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

      funcTable.push({ name, startAt });
    },

    Func(funcPath: NodePath) {
      module.beginFuncBody(funcPath.node);

      traverse(funcPath.node, {

@webassemblyjs/helper-flatten-ast

Flatten an AST helper

MIT
Latest version published 1 month ago

Package Health Score

78 / 100
Full package analysis

Popular @webassemblyjs/helper-flatten-ast functions

Similar packages