Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var _nodes11 = parseDataSection(_numberOfElements2);
return {
nodes: _nodes11,
metadata: _metadata11,
nextSectionIndex: nextSectionIndex
};
}
}
case constants.sections.custom:
{
dumpSep("section Custom");
dump([sectionId], "section code");
dump([sectionSizeInBytes], "section size");
var _metadata12 = [t.sectionMetadata("custom", startOffset, sectionSizeInBytesNode)];
var sectionName = readUTF8String();
eatBytes(sectionName.nextIndex);
dump([], "section name (".concat(sectionName.value, ")"));
var _remainingBytes2 = sectionSizeInBytes - sectionName.nextIndex;
if (sectionName.value === "name") {
try {
_metadata12.push.apply(_metadata12, _toConsumableArray(parseNameSection(_remainingBytes2)));
} catch (e) {
console.warn("Failed to decode custom \"name\" section @".concat(offset, "; ignoring (").concat(e.message, ")."));
eatBytes(_remainingBytes2);
}
} else {
// We don't parse the custom section
eatBytes(_remainingBytes2);
var _nodes10 = parseMemorySection(_numberOfElements);
return {
nodes: _nodes10,
metadata: _metadata10,
nextSectionIndex: nextSectionIndex
};
}
case sections.data:
{
dumpSep("section Data");
dump([sectionId], "section code");
dump([sectionSizeInBytes], "section size");
var _metadata11 = t.sectionMetadata("data", startOffset, sectionSizeInBytesNode);
var _startPosition10 = getPosition();
var _numberOfElementsu2 = readU32();
var _numberOfElements2 = _numberOfElementsu2.value;
eatBytes(_numberOfElementsu2.nextIndex);
var _endPosition9 = getPosition();
_metadata11.vectorOfSize = t.withLoc(t.numberLiteralFromRaw(_numberOfElements2), _endPosition9, _startPosition10);
if (opts.ignoreDataSection === true) {
var _remainingBytes = // $FlowIgnore
sectionSizeInBytes - _numberOfElements2.nextIndex;
return { nodes, metadata, nextSectionIndex };
}
case constants.sections.global: {
dumpSep("section Global");
dump([sectionId], "section code");
dump([sectionSizeInBytes], "section size");
const startLoc = getPosition();
const numberOfGlobalsu32 = readU32();
const numberOfGlobals = numberOfGlobalsu32.value;
eatBytes(numberOfGlobalsu32.nextIndex);
const metadata = t.sectionMetadata(
"global",
startOffset,
sectionSizeInBytesNode,
WITH_LOC(t.numberLiteralFromRaw(numberOfGlobals), startLoc)
);
const nodes = parseGlobalSection(numberOfGlobals);
return { nodes, metadata, nextSectionIndex };
}
case constants.sections.memory: {
dumpSep("section Memory");
dump([sectionId], "section code");
dump([sectionSizeInBytes], "section size");
dumpSep("section Table");
dump([sectionId], "section code");
dump([sectionSizeInBytes], "section size");
var _startPosition2 = getPosition();
var _u2 = readU32();
var numberOfTable = _u2.value;
eatBytes(_u2.nextIndex);
var _endPosition = getPosition();
dump([numberOfTable], "num tables");
var _metadata2 = t.sectionMetadata("table", startOffset, sectionSizeInBytesNode, t.withLoc(t.numberLiteralFromRaw(numberOfTable), _endPosition, _startPosition2));
var _nodes2 = parseTableSection(numberOfTable);
return {
nodes: _nodes2,
metadata: _metadata2,
nextSectionIndex: nextSectionIndex
};
}
case sections.import:
{
dumpSep("section Import");
dump([sectionId], "section code");
dump([sectionSizeInBytes], "section size");
}
case constants.sections.memory:
{
dumpSep("section Memory");
dump([sectionId], "section code");
dump([sectionSizeInBytes], "section size");
var _startLoc21 = getPosition();
var _numberOfElementsu = readU32();
var _numberOfElements = _numberOfElementsu.value;
eatBytes(_numberOfElementsu.nextIndex);
var _metadata10 = t.sectionMetadata("memory", startOffset, sectionSizeInBytesNode, function () {
var endLoc = getPosition();
return t.withLoc(t.numberLiteralFromRaw(_numberOfElements), endLoc, _startLoc21);
}());
var _nodes10 = parseMemorySection(_numberOfElements);
return {
nodes: _nodes10,
metadata: _metadata10,
nextSectionIndex: nextSectionIndex
};
}
case constants.sections.data:
{
dumpSep("section Data");
}
case constants.sections.import: {
dumpSep("section Import");
dump([sectionId], "section code");
dump([sectionSizeInBytes], "section size");
const startLoc = getPosition();
const numberOfImportsu32 = readU32();
const numberOfImports = numberOfImportsu32.value;
eatBytes(numberOfImportsu32.nextIndex);
dump([numberOfImports], "number of imports");
const metadata = t.sectionMetadata(
"import",
startOffset,
sectionSizeInBytesNode,
WITH_LOC(t.numberLiteralFromRaw(numberOfImports), startLoc)
);
const nodes = parseImportSection(numberOfImports);
return { nodes, metadata, nextSectionIndex };
}
case constants.sections.func: {
dumpSep("section Function");
dump([sectionId], "section code");
dump([sectionSizeInBytes], "section size");
case sections.memory:
{
dumpSep("section Memory");
dump([sectionId], "section code");
dump([sectionSizeInBytes], "section size");
var _startPosition9 = getPosition();
var _numberOfElementsu = readU32();
var _numberOfElements = _numberOfElementsu.value;
eatBytes(_numberOfElementsu.nextIndex);
var _endPosition8 = getPosition();
var _metadata10 = t.sectionMetadata("memory", startOffset, sectionSizeInBytesNode, t.withLoc(t.numberLiteralFromRaw(_numberOfElements), _endPosition8, _startPosition9));
var _nodes10 = parseMemorySection(_numberOfElements);
return {
nodes: _nodes10,
metadata: _metadata10,
nextSectionIndex: nextSectionIndex
};
}
case sections.data:
{
dumpSep("section Data");
dump([sectionId], "section code");
dump([sectionSizeInBytes], "section size");
};
}
case constants.sections.element:
{
dumpSep("section Element");
dump([sectionId], "section code");
dump([sectionSizeInBytes], "section size");
var _startLoc19 = getPosition();
var numberOfElementsu32 = readU32();
var numberOfElements = numberOfElementsu32.value;
eatBytes(numberOfElementsu32.nextIndex);
var _metadata8 = t.sectionMetadata("element", startOffset, sectionSizeInBytesNode, function () {
var endLoc = getPosition();
return t.withLoc(t.numberLiteralFromRaw(numberOfElements), endLoc, _startLoc19);
}());
var _nodes8 = parseElemSection(numberOfElements);
return {
nodes: _nodes8,
metadata: _metadata8,
nextSectionIndex: nextSectionIndex
};
}
case constants.sections.global:
{
dumpSep("section Global");
switch (sectionId) {
case constants.sections.type:
{
dumpSep("section Type");
dump([sectionId], "section code");
dump([sectionSizeInBytes], "section size");
var _startLoc13 = getPosition();
var _u = readU32();
var numberOfTypes = _u.value;
eatBytes(_u.nextIndex);
var _metadata = t.sectionMetadata("type", startOffset, sectionSizeInBytesNode, function () {
var endLoc = getPosition();
return t.withLoc(t.numberLiteralFromRaw(numberOfTypes), endLoc, _startLoc13);
}());
var _nodes = parseTypeSection(numberOfTypes);
return {
nodes: _nodes,
metadata: _metadata,
nextSectionIndex: nextSectionIndex
};
}
case constants.sections.table:
{
dumpSep("section Table");
var _nodes6 = [];
return {
nodes: _nodes6,
metadata: _metadata6,
nextSectionIndex: nextSectionIndex
};
}
case constants.sections.start:
{
dumpSep("section Start");
dump([sectionId], "section code");
dump([sectionSizeInBytes], "section size");
var _metadata7 = t.sectionMetadata("start", startOffset, sectionSizeInBytesNode);
var _nodes7 = [parseStartSection()];
return {
nodes: _nodes7,
metadata: _metadata7,
nextSectionIndex: nextSectionIndex
};
}
case constants.sections.element:
{
dumpSep("section Element");
dump([sectionId], "section code");
dump([sectionSizeInBytes], "section size");
var _startLoc19 = getPosition();