MCPcopy
hub / github.com/webpack/webpack / getNextFuncIndex

Function getNextFuncIndex

lib/wasm-sync/WebAssemblyGenerator.js:134–144  ·  view source on GitHub ↗
(ast, countImportedFunc)

Source from the content-addressed store, hash-verified

132 * @returns {t.Index} - index
133 */
134const getNextFuncIndex = (ast, countImportedFunc) => {
135 const funcSectionMetadata = t.getSectionMetadata(ast, "func");
136
137 if (funcSectionMetadata === undefined) {
138 return t.indexLiteral(0 + countImportedFunc);
139 }
140
141 const vectorOfSize = funcSectionMetadata.vectorOfSize.value;
142
143 return t.indexLiteral(vectorOfSize + countImportedFunc);
144};
145
146/**
147 * Creates an init instruction for a global type

Callers 1

generateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected