How to use the @webassemblyjs/validation.stack function in @webassemblyjs/validation

To help you get started, we’ve selected a few @webassemblyjs/validation 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 / repl / src / index.js View on Github external
function createModuleInstanceFromAst(moduleNode, enableTypeChecking = false) {
    const internalInstanceOptions = {
      checkForI64InSignature: false,
      returnStackLocal: true
    };

    const importObject = {
      _internalInstanceOptions: internalInstanceOptions
    };

    if (enableTypeChecking === true) {
      denormalizeTypeReferences(moduleNode);

      const typeErrors = typeCheck(t.program([moduleNode]));

      if (typeErrors.length > 0) {
        const containsImmutableGlobalViolation = typeErrors.some(
          x => x === "global is immutable"
        );

        if (containsImmutableGlobalViolation) {
          throw new Error("global is immutable");
        }

        throw new Error("type mismatch");
      }
    }

    const compiledModule = createCompiledModule(moduleNode);

@webassemblyjs/validation

Module AST validations

MIT
Latest version published 2 months ago

Package Health Score

83 / 100
Full package analysis