Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function parseVersion() {
if (isEOF() === true || offset + 4 > buf.length) {
throw new Error("unexpected end");
}
var version = readBytes(4);
if (byteArrayEq(constants.moduleVersion, version) === false) {
throw new CompileError("unknown binary version");
}
dump(version, "wasm version");
eatBytes(4);
}
export function encodeVersion(v) {
var bytes = constants.moduleVersion;
bytes[0] = v;
return bytes;
}
export function encodeHeader() {
function parseVersion() {
if (isEOF() === true || offset + 4 > buf.length) {
throw new Error("unexpected end");
}
var version = readBytes(4);
if (byteArrayEq(constants.moduleVersion, version) === false) {
throw new CompileError("unknown binary version");
}
dump(version, "wasm version");
eatBytes(4);
}
export function encodeVersion(v) {
var bytes = constants.moduleVersion;
bytes[0] = v;
return bytes;
}
export function encodeHeader() {
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
var t = require("@webassemblyjs/ast");
var _require = require("@webassemblyjs/helper-wasm-bytecode"),
importTypes = _require.importTypes,
symbolsByByte = _require.symbolsByByte,
blockTypes = _require.blockTypes,
tableTypes = _require.tableTypes,
globalTypes = _require.globalTypes,
exportTypes = _require.exportTypes,
types = _require.types,
magicModuleHeader = _require.magicModuleHeader,
valtypes = _require.valtypes,
moduleVersion = _require.moduleVersion,
sections = _require.sections;
/**
* FIXME(sven): we can't do that because number > 2**53 will fail here
* because they cannot be represented in js.
*/
function badI32ToI64Conversion(value) {
return {
high: value < 0 ? -1 : 0,
low: value >>> 0
};
}
function toHex(n) {
return "0x" + Number(n).toString(16);
export function encodeVersion(v: number): Array {
const bytes = constants.moduleVersion;
bytes[0] = v;
return bytes;
}
function parseVersion() {
if (isEOF() === true || offset + 4 > buf.length) {
throw new Error("unexpected end");
}
var version = readBytes(4);
if (byteArrayEq(constants.moduleVersion, version) === false) {
throw new CompileError("unknown binary version");
}
dump(version, "wasm version");
eatBytes(4);
}
function parseVersion() {
if (isEOF() === true || offset + 4 > buf.length) {
throw new Error("unexpected end");
}
const version = readBytes(4);
if (byteArrayEq(constants.moduleVersion, version) === false) {
throw new CompileError("unknown binary version");
}
dump(version, "wasm version");
eatBytes(4);
}