How to use the webassemblyjs/lib/errors.RuntimeError function in webassemblyjs

To help you get started, we’ve selected a few webassemblyjs 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 / validation / src / func-result-type.js View on Github external
Func({ node }: NodePath) {
      if (node.signature.type !== "Signature") {
        throw new RuntimeError(
          "Function signatures must be denormalised before execution"
        );
      }

      const signature = (node.signature: Signature);
      // Since only one return is allowed at the moment, we don't need to check
      // them all.
      const resultType = signature.results;

      const inferedResultType = getType(node.body);

      // Type is unknown, we can not verify the result type
      if (typeof inferedResultType === "undefined") {
        return;
      }