How to use the @webassemblyjs/helper-wasm-section.resizeSectionVecSize function in @webassemblyjs/helper-wasm-section

To help you get started, we’ve selected a few @webassemblyjs/helper-wasm-section 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 flaviuse / mern-authentication / client / node_modules / @webassemblyjs / wasm-edit / esm / apply.js View on Github external
default:
        throw new Error("Unknown operation");
    }
    /**
     * Resize section vec size.
     * If the length of the LEB-encoded size changes, this can change
     * the byte length of the section and the offset for nodes in the
     * section. So we do this first before resizing section byte size
     * or shifting following operations' nodes.
     */


    if (state.deltaElements !== 0 && sectionName !== "start") {
      var oldBufferLength = state.uint8Buffer.length;
      state.uint8Buffer = resizeSectionVecSize(ast, state.uint8Buffer, sectionName, state.deltaElements); // Infer bytes added/removed by comparing buffer lengths

      state.deltaBytes += state.uint8Buffer.length - oldBufferLength;
    }
    /**
     * Resize section byte size.
     * If the length of the LEB-encoded size changes, this can change
     * the offset for nodes in the section. So we do this before
     * shifting following operations' nodes.
     */


    if (state.deltaBytes !== 0 && sectionName !== "start") {
      var _oldBufferLength = state.uint8Buffer.length;
      state.uint8Buffer = resizeSectionByteSize(ast, state.uint8Buffer, sectionName, state.deltaBytes); // Infer bytes added/removed by comparing buffer lengths

      state.deltaBytes += state.uint8Buffer.length - _oldBufferLength;
github zc910704 / Vue.js-personal-note / www / day6.1.webpack的url-loader与babel / node_modules / @webassemblyjs / wasm-edit / esm / apply.js View on Github external
default:
        throw new Error("Unknown operation");
    }
    /**
     * Resize section vec size.
     * If the length of the LEB-encoded size changes, this can change
     * the byte length of the section and the offset for nodes in the
     * section. So we do this first before resizing section byte size
     * or shifting following operations' nodes.
     */


    if (state.deltaElements !== 0 && sectionName !== "start") {
      var oldBufferLength = state.uint8Buffer.length;
      state.uint8Buffer = resizeSectionVecSize(ast, state.uint8Buffer, sectionName, state.deltaElements); // Infer bytes added/removed by comparing buffer lengths

      state.deltaBytes += state.uint8Buffer.length - oldBufferLength;
    }
    /**
     * Resize section byte size.
     * If the length of the LEB-encoded size changes, this can change
     * the offset for nodes in the section. So we do this before
     * shifting following operations' nodes.
     */


    if (state.deltaBytes !== 0 && sectionName !== "start") {
      var _oldBufferLength = state.uint8Buffer.length;
      state.uint8Buffer = resizeSectionByteSize(ast, state.uint8Buffer, sectionName, state.deltaBytes); // Infer bytes added/removed by comparing buffer lengths

      state.deltaBytes += state.uint8Buffer.length - _oldBufferLength;
github xtuc / webassemblyjs / packages / wasm-edit / src / apply.js View on Github external
break;

      default:
        throw new Error("Unknown operation");
    }

    /**
     * Resize section vec size.
     * If the length of the LEB-encoded size changes, this can change
     * the byte length of the section and the offset for nodes in the
     * section. So we do this first before resizing section byte size
     * or shifting following operations' nodes.
     */
    if (state.deltaElements !== 0 && sectionName !== "start") {
      const oldBufferLength = state.uint8Buffer.length;
      state.uint8Buffer = resizeSectionVecSize(
        ast,
        state.uint8Buffer,
        sectionName,
        state.deltaElements
      );
      // Infer bytes added/removed by comparing buffer lengths
      state.deltaBytes += state.uint8Buffer.length - oldBufferLength;
    }

    /**
     * Resize section byte size.
     * If the length of the LEB-encoded size changes, this can change
     * the offset for nodes in the section. So we do this before
     * shifting following operations' nodes.
     */
    if (state.deltaBytes !== 0 && sectionName !== "start") {
github xtuc / webassemblyjs / packages / wasm-edit / src / apply.js View on Github external
break;
        }
      });

      if (sectionName !== "start") {
        state.uint8Buffer = resizeSectionByteSize(
          ast,
          state.uint8Buffer,
          sectionName,
          state.deltaBytes
        );
      }
    }

    if (state.deltaElements !== 0 && sectionName !== "start") {
      state.uint8Buffer = resizeSectionVecSize(
        ast,
        state.uint8Buffer,
        sectionName,
        state.deltaElements
      );
    }

    uint8Buffer = state.uint8Buffer;
  });