feat: refactoring project
This commit is contained in:
10
node_modules/@webassemblyjs/ast/package.json
generated
vendored
10
node_modules/@webassemblyjs/ast/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@webassemblyjs/ast",
|
||||
"version": "1.12.1",
|
||||
"version": "1.14.1",
|
||||
"description": "AST utils for webassemblyjs",
|
||||
"keywords": [
|
||||
"webassembly",
|
||||
@@ -12,8 +12,8 @@
|
||||
"author": "Sven Sauleau",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@webassemblyjs/helper-numbers": "1.11.6",
|
||||
"@webassemblyjs/helper-wasm-bytecode": "1.11.6"
|
||||
"@webassemblyjs/helper-numbers": "1.13.2",
|
||||
"@webassemblyjs/helper-wasm-bytecode": "1.13.2"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -23,10 +23,10 @@
|
||||
"access": "public"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@webassemblyjs/helper-test-framework": "1.12.1",
|
||||
"@webassemblyjs/helper-test-framework": "1.14.1",
|
||||
"array.prototype.flatmap": "^1.2.1",
|
||||
"dump-exports": "^0.1.0",
|
||||
"mamacro": "^0.0.7"
|
||||
},
|
||||
"gitHead": "67c75cf2da65e5588b5e81c10b0d7692d174760b"
|
||||
"gitHead": "25d52b1296e151ac56244a7c3886661e6b4a69ea"
|
||||
}
|
||||
|
||||
5
node_modules/@webassemblyjs/floating-point-hex-parser/package.json
generated
vendored
5
node_modules/@webassemblyjs/floating-point-hex-parser/package.json
generated
vendored
@@ -10,7 +10,7 @@
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"version": "1.11.6",
|
||||
"version": "1.13.2",
|
||||
"description": "A function to parse floating point hexadecimal strings as defined by the WebAssembly specification",
|
||||
"main": "lib/index.js",
|
||||
"module": "esm/index.js",
|
||||
@@ -19,5 +19,6 @@
|
||||
"floating-point"
|
||||
],
|
||||
"author": "Mauro Bringolf",
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"gitHead": "897aeb784f042a46a00626f1d1cca96159aa5db3"
|
||||
}
|
||||
|
||||
5
node_modules/@webassemblyjs/helper-api-error/package.json
generated
vendored
5
node_modules/@webassemblyjs/helper-api-error/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@webassemblyjs/helper-api-error",
|
||||
"version": "1.11.6",
|
||||
"version": "1.13.2",
|
||||
"description": "Common API errors",
|
||||
"main": "lib/index.js",
|
||||
"module": "esm/index.js",
|
||||
@@ -13,5 +13,6 @@
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
},
|
||||
"gitHead": "897aeb784f042a46a00626f1d1cca96159aa5db3"
|
||||
}
|
||||
|
||||
6
node_modules/@webassemblyjs/helper-buffer/package.json
generated
vendored
6
node_modules/@webassemblyjs/helper-buffer/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@webassemblyjs/helper-buffer",
|
||||
"version": "1.12.1",
|
||||
"version": "1.14.1",
|
||||
"description": "Buffer manipulation utility",
|
||||
"main": "lib/index.js",
|
||||
"module": "esm/index.js",
|
||||
@@ -17,8 +17,8 @@
|
||||
"author": "Sven Sauleau",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@webassemblyjs/wasm-parser": "1.12.1",
|
||||
"@webassemblyjs/wasm-parser": "1.14.1",
|
||||
"jest-diff": "^24.0.0"
|
||||
},
|
||||
"gitHead": "67c75cf2da65e5588b5e81c10b0d7692d174760b"
|
||||
"gitHead": "25d52b1296e151ac56244a7c3886661e6b4a69ea"
|
||||
}
|
||||
|
||||
9
node_modules/@webassemblyjs/helper-numbers/package.json
generated
vendored
9
node_modules/@webassemblyjs/helper-numbers/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@webassemblyjs/helper-numbers",
|
||||
"version": "1.11.6",
|
||||
"version": "1.13.2",
|
||||
"description": "Number parsing utility",
|
||||
"main": "lib/index.js",
|
||||
"module": "esm/index.js",
|
||||
@@ -15,10 +15,11 @@
|
||||
"access": "public"
|
||||
},
|
||||
"dependencies": {
|
||||
"@webassemblyjs/floating-point-hex-parser": "1.11.6",
|
||||
"@webassemblyjs/helper-api-error": "1.11.6",
|
||||
"@webassemblyjs/floating-point-hex-parser": "1.13.2",
|
||||
"@webassemblyjs/helper-api-error": "1.13.2",
|
||||
"@xtuc/long": "4.2.2"
|
||||
},
|
||||
"author": "Sven Sauleau",
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"gitHead": "897aeb784f042a46a00626f1d1cca96159aa5db3"
|
||||
}
|
||||
|
||||
32
node_modules/@webassemblyjs/helper-wasm-bytecode/lib/index.js
generated
vendored
32
node_modules/@webassemblyjs/helper-wasm-bytecode/lib/index.js
generated
vendored
@@ -74,15 +74,21 @@ var exportTypes = {
|
||||
};
|
||||
var exportTypesByName = invertMap(exportTypes);
|
||||
var valtypes = {
|
||||
// numtype
|
||||
0x7f: "i32",
|
||||
0x7e: "i64",
|
||||
0x7d: "f32",
|
||||
0x7c: "f64",
|
||||
0x7b: "v128"
|
||||
// vectype
|
||||
0x7b: "v128",
|
||||
// reftype
|
||||
0x70: "anyfunc",
|
||||
0x6f: "externref"
|
||||
};
|
||||
var valtypesByString = invertMap(valtypes);
|
||||
var tableTypes = {
|
||||
0x70: "anyfunc"
|
||||
0x70: "anyfunc",
|
||||
0x6f: "externref"
|
||||
};
|
||||
var blockTypes = Object.assign({}, valtypes, {
|
||||
// https://webassembly.github.io/spec/core/binary/types.html#binary-blocktype
|
||||
@@ -156,8 +162,8 @@ var symbolsByByte = {
|
||||
0x22: createSymbol("tee_local", 1),
|
||||
0x23: createSymbol("get_global", 1),
|
||||
0x24: createSymbol("set_global", 1),
|
||||
0x25: illegalop,
|
||||
0x26: illegalop,
|
||||
0x25: createSymbol("table.get", 1),
|
||||
0x26: createSymbol("table.set", 1),
|
||||
0x27: illegalop,
|
||||
0x28: createSymbolObject("load", "u32", 1),
|
||||
0x29: createSymbolObject("load", "u64", 1),
|
||||
@@ -311,6 +317,24 @@ var symbolsByByte = {
|
||||
0xbd: createSymbolObject("reinterpret/f64", "i64"),
|
||||
0xbe: createSymbolObject("reinterpret/i32", "f32"),
|
||||
0xbf: createSymbolObject("reinterpret/i64", "f64"),
|
||||
0xc0: createSymbolObject("extend8_s", "i32"),
|
||||
0xc1: createSymbolObject("extend16_s", "i32"),
|
||||
0xc2: createSymbolObject("extend8_s", "i64"),
|
||||
0xc3: createSymbolObject("extend16_s", "i64"),
|
||||
0xc4: createSymbolObject("extend32_s", "i64"),
|
||||
0xd0: createSymbol("ref.null"),
|
||||
0xd1: createSymbol("ref.is_null"),
|
||||
0xd2: createSymbol("ref.func", 1),
|
||||
0xfc0a: createSymbol("memory.copy"),
|
||||
0xfc0b: createSymbol("memory.fill"),
|
||||
// Table instructions
|
||||
// https://webassembly.github.io/spec/core/binary/instructions.html#table-instructions
|
||||
0xfc0c: createSymbol("table.init", 2),
|
||||
0xfc0d: createSymbol("elem.drop", 1),
|
||||
0xfc0e: createSymbol("table.copy", 2),
|
||||
0xfc0f: createSymbol("table.grow", 1),
|
||||
0xfc10: createSymbol("table.size", 1),
|
||||
0xfc11: createSymbol("table.fill", 1),
|
||||
// Atomic Memory Instructions
|
||||
0xfe00: createSymbol("memory.atomic.notify", 1),
|
||||
0xfe01: createSymbol("memory.atomic.wait32", 1),
|
||||
|
||||
5
node_modules/@webassemblyjs/helper-wasm-bytecode/package.json
generated
vendored
5
node_modules/@webassemblyjs/helper-wasm-bytecode/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@webassemblyjs/helper-wasm-bytecode",
|
||||
"version": "1.11.6",
|
||||
"version": "1.13.2",
|
||||
"description": "WASM's Bytecode constants",
|
||||
"main": "lib/index.js",
|
||||
"module": "esm/index.js",
|
||||
@@ -15,5 +15,6 @@
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
},
|
||||
"gitHead": "897aeb784f042a46a00626f1d1cca96159aa5db3"
|
||||
}
|
||||
|
||||
14
node_modules/@webassemblyjs/helper-wasm-section/package.json
generated
vendored
14
node_modules/@webassemblyjs/helper-wasm-section/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@webassemblyjs/helper-wasm-section",
|
||||
"version": "1.12.1",
|
||||
"version": "1.14.1",
|
||||
"description": "",
|
||||
"main": "lib/index.js",
|
||||
"module": "esm/index.js",
|
||||
@@ -17,13 +17,13 @@
|
||||
"author": "Sven Sauleau",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@webassemblyjs/ast": "1.12.1",
|
||||
"@webassemblyjs/helper-buffer": "1.12.1",
|
||||
"@webassemblyjs/helper-wasm-bytecode": "1.11.6",
|
||||
"@webassemblyjs/wasm-gen": "1.12.1"
|
||||
"@webassemblyjs/ast": "1.14.1",
|
||||
"@webassemblyjs/helper-buffer": "1.14.1",
|
||||
"@webassemblyjs/helper-wasm-bytecode": "1.13.2",
|
||||
"@webassemblyjs/wasm-gen": "1.14.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@webassemblyjs/wasm-parser": "1.12.1"
|
||||
"@webassemblyjs/wasm-parser": "1.14.1"
|
||||
},
|
||||
"gitHead": "67c75cf2da65e5588b5e81c10b0d7692d174760b"
|
||||
"gitHead": "25d52b1296e151ac56244a7c3886661e6b4a69ea"
|
||||
}
|
||||
|
||||
4
node_modules/@webassemblyjs/ieee754/lib/index.js
generated
vendored
4
node_modules/@webassemblyjs/ieee754/lib/index.js
generated
vendored
@@ -42,11 +42,11 @@ function encodeF64(v) {
|
||||
}
|
||||
|
||||
function decodeF32(bytes) {
|
||||
var buffer = Buffer.from(bytes);
|
||||
var buffer = new Uint8Array(bytes);
|
||||
return (0, _ieee.read)(buffer, 0, true, SINGLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F32);
|
||||
}
|
||||
|
||||
function decodeF64(bytes) {
|
||||
var buffer = Buffer.from(bytes);
|
||||
var buffer = new Uint8Array(bytes);
|
||||
return (0, _ieee.read)(buffer, 0, true, DOUBLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F64);
|
||||
}
|
||||
5
node_modules/@webassemblyjs/ieee754/package.json
generated
vendored
5
node_modules/@webassemblyjs/ieee754/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@webassemblyjs/ieee754",
|
||||
"version": "1.11.6",
|
||||
"version": "1.13.2",
|
||||
"description": "IEEE754 decoder and encoder",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
@@ -18,5 +18,6 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@xtuc/ieee754": "^1.2.0"
|
||||
}
|
||||
},
|
||||
"gitHead": "897aeb784f042a46a00626f1d1cca96159aa5db3"
|
||||
}
|
||||
|
||||
4
node_modules/@webassemblyjs/ieee754/src/index.js
generated
vendored
4
node_modules/@webassemblyjs/ieee754/src/index.js
generated
vendored
@@ -35,13 +35,13 @@ export function encodeF64(v: number): Array<number> {
|
||||
}
|
||||
|
||||
export function decodeF32(bytes: Array<Byte>): number {
|
||||
const buffer = Buffer.from(bytes);
|
||||
const buffer = new Uint8Array(bytes);
|
||||
|
||||
return read(buffer, 0, true, SINGLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F32);
|
||||
}
|
||||
|
||||
export function decodeF64(bytes: Array<Byte>): number {
|
||||
const buffer = Buffer.from(bytes);
|
||||
const buffer = new Uint8Array(bytes);
|
||||
|
||||
return read(buffer, 0, true, DOUBLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F64);
|
||||
}
|
||||
|
||||
18
node_modules/@webassemblyjs/leb128/lib/bufs.js
generated
vendored
18
node_modules/@webassemblyjs/leb128/lib/bufs.js
generated
vendored
@@ -98,7 +98,7 @@ function alloc(length) {
|
||||
if (result) {
|
||||
bufPool[length] = undefined;
|
||||
} else {
|
||||
result = new Buffer(length);
|
||||
result = new Uint8Array(length);
|
||||
}
|
||||
|
||||
result.fill(0);
|
||||
@@ -130,7 +130,11 @@ function resize(buffer, length) {
|
||||
}
|
||||
|
||||
var newBuf = alloc(length);
|
||||
buffer.copy(newBuf);
|
||||
|
||||
for (var i = 0; i <= buffer.length; i++) {
|
||||
newBuf[i] = buffer[i];
|
||||
}
|
||||
|
||||
free(buffer);
|
||||
return newBuf;
|
||||
}
|
||||
@@ -231,6 +235,12 @@ function writeUInt64(value, buffer) {
|
||||
|
||||
var lowWord = value % BIT_32;
|
||||
var highWord = Math.floor(value / BIT_32);
|
||||
buffer.writeUInt32LE(lowWord, 0);
|
||||
buffer.writeUInt32LE(highWord, 4);
|
||||
buffer[0] = lowWord & 0xff;
|
||||
buffer[1] = lowWord >> 8 & 0xff;
|
||||
buffer[2] = lowWord >> 16 & 0xff;
|
||||
buffer[3] = lowWord >> 24 & 0xff;
|
||||
buffer[4] = highWord & 0xff;
|
||||
buffer[5] = highWord >> 8 & 0xff;
|
||||
buffer[6] = highWord >> 16 & 0xff;
|
||||
buffer[7] = highWord >> 24 & 0xff;
|
||||
}
|
||||
16
node_modules/@webassemblyjs/leb128/lib/leb.js
generated
vendored
16
node_modules/@webassemblyjs/leb128/lib/leb.js
generated
vendored
@@ -222,10 +222,12 @@ function decodeIntBuffer(encodedBuffer, index) {
|
||||
}
|
||||
|
||||
function encodeInt32(num) {
|
||||
var buf = bufs.alloc(4);
|
||||
buf.writeInt32LE(num, 0);
|
||||
var buf = new Uint8Array(4);
|
||||
buf[0] = num & 0xff;
|
||||
buf[1] = num >> 8 & 0xff;
|
||||
buf[2] = num >> 16 & 0xff;
|
||||
buf[3] = num >> 24 & 0xff;
|
||||
var result = encodeIntBuffer(buf);
|
||||
bufs.free(buf);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -282,10 +284,12 @@ function decodeUIntBuffer(encodedBuffer, index) {
|
||||
}
|
||||
|
||||
function encodeUInt32(num) {
|
||||
var buf = bufs.alloc(4);
|
||||
buf.writeUInt32LE(num, 0);
|
||||
var buf = new Uint8Array(4);
|
||||
buf[0] = num & 0xff;
|
||||
buf[1] = num >> 8 & 0xff;
|
||||
buf[2] = num >> 16 & 0xff;
|
||||
buf[3] = num >> 24 & 0xff;
|
||||
var result = encodeUIntBuffer(buf);
|
||||
bufs.free(buf);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
5
node_modules/@webassemblyjs/leb128/package.json
generated
vendored
5
node_modules/@webassemblyjs/leb128/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@webassemblyjs/leb128",
|
||||
"version": "1.11.6",
|
||||
"version": "1.13.2",
|
||||
"description": "LEB128 decoder and encoder",
|
||||
"license": "Apache-2.0",
|
||||
"main": "lib/index.js",
|
||||
@@ -18,5 +18,6 @@
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
},
|
||||
"gitHead": "897aeb784f042a46a00626f1d1cca96159aa5db3"
|
||||
}
|
||||
|
||||
5
node_modules/@webassemblyjs/utf8/package.json
generated
vendored
5
node_modules/@webassemblyjs/utf8/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@webassemblyjs/utf8",
|
||||
"version": "1.11.6",
|
||||
"version": "1.13.2",
|
||||
"description": "UTF8 encoder/decoder for WASM",
|
||||
"main": "lib/index.js",
|
||||
"module": "esm/index.js",
|
||||
@@ -15,5 +15,6 @@
|
||||
"access": "public"
|
||||
},
|
||||
"author": "Sven Sauleau",
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"gitHead": "897aeb784f042a46a00626f1d1cca96159aa5db3"
|
||||
}
|
||||
|
||||
22
node_modules/@webassemblyjs/wasm-edit/package.json
generated
vendored
22
node_modules/@webassemblyjs/wasm-edit/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@webassemblyjs/wasm-edit",
|
||||
"version": "1.12.1",
|
||||
"version": "1.14.1",
|
||||
"description": "",
|
||||
"main": "lib/index.js",
|
||||
"module": "esm/index.js",
|
||||
@@ -17,17 +17,17 @@
|
||||
"author": "Sven Sauleau",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@webassemblyjs/ast": "1.12.1",
|
||||
"@webassemblyjs/helper-buffer": "1.12.1",
|
||||
"@webassemblyjs/helper-wasm-bytecode": "1.11.6",
|
||||
"@webassemblyjs/helper-wasm-section": "1.12.1",
|
||||
"@webassemblyjs/wasm-gen": "1.12.1",
|
||||
"@webassemblyjs/wasm-opt": "1.12.1",
|
||||
"@webassemblyjs/wasm-parser": "1.12.1",
|
||||
"@webassemblyjs/wast-printer": "1.12.1"
|
||||
"@webassemblyjs/ast": "1.14.1",
|
||||
"@webassemblyjs/helper-buffer": "1.14.1",
|
||||
"@webassemblyjs/helper-wasm-bytecode": "1.13.2",
|
||||
"@webassemblyjs/helper-wasm-section": "1.14.1",
|
||||
"@webassemblyjs/wasm-gen": "1.14.1",
|
||||
"@webassemblyjs/wasm-opt": "1.14.1",
|
||||
"@webassemblyjs/wasm-parser": "1.14.1",
|
||||
"@webassemblyjs/wast-printer": "1.14.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@webassemblyjs/helper-test-framework": "1.12.1"
|
||||
"@webassemblyjs/helper-test-framework": "1.14.1"
|
||||
},
|
||||
"gitHead": "67c75cf2da65e5588b5e81c10b0d7692d174760b"
|
||||
"gitHead": "25d52b1296e151ac56244a7c3886661e6b4a69ea"
|
||||
}
|
||||
|
||||
14
node_modules/@webassemblyjs/wasm-gen/package.json
generated
vendored
14
node_modules/@webassemblyjs/wasm-gen/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@webassemblyjs/wasm-gen",
|
||||
"version": "1.12.1",
|
||||
"version": "1.14.1",
|
||||
"description": "WebAssembly binary format printer",
|
||||
"main": "lib/index.js",
|
||||
"module": "esm/index.js",
|
||||
@@ -17,11 +17,11 @@
|
||||
"author": "Sven Sauleau",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@webassemblyjs/ast": "1.12.1",
|
||||
"@webassemblyjs/helper-wasm-bytecode": "1.11.6",
|
||||
"@webassemblyjs/ieee754": "1.11.6",
|
||||
"@webassemblyjs/leb128": "1.11.6",
|
||||
"@webassemblyjs/utf8": "1.11.6"
|
||||
"@webassemblyjs/ast": "1.14.1",
|
||||
"@webassemblyjs/helper-wasm-bytecode": "1.13.2",
|
||||
"@webassemblyjs/ieee754": "1.13.2",
|
||||
"@webassemblyjs/leb128": "1.13.2",
|
||||
"@webassemblyjs/utf8": "1.13.2"
|
||||
},
|
||||
"gitHead": "67c75cf2da65e5588b5e81c10b0d7692d174760b"
|
||||
"gitHead": "25d52b1296e151ac56244a7c3886661e6b4a69ea"
|
||||
}
|
||||
|
||||
12
node_modules/@webassemblyjs/wasm-opt/package.json
generated
vendored
12
node_modules/@webassemblyjs/wasm-opt/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@webassemblyjs/wasm-opt",
|
||||
"version": "1.12.1",
|
||||
"version": "1.14.1",
|
||||
"description": "",
|
||||
"main": "lib/index.js",
|
||||
"module": "esm/index.js",
|
||||
@@ -17,10 +17,10 @@
|
||||
"author": "Sven Sauleau",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@webassemblyjs/ast": "1.12.1",
|
||||
"@webassemblyjs/helper-buffer": "1.12.1",
|
||||
"@webassemblyjs/wasm-gen": "1.12.1",
|
||||
"@webassemblyjs/wasm-parser": "1.12.1"
|
||||
"@webassemblyjs/ast": "1.14.1",
|
||||
"@webassemblyjs/helper-buffer": "1.14.1",
|
||||
"@webassemblyjs/wasm-gen": "1.14.1",
|
||||
"@webassemblyjs/wasm-parser": "1.14.1"
|
||||
},
|
||||
"gitHead": "67c75cf2da65e5588b5e81c10b0d7692d174760b"
|
||||
"gitHead": "25d52b1296e151ac56244a7c3886661e6b4a69ea"
|
||||
}
|
||||
|
||||
271
node_modules/@webassemblyjs/wasm-parser/esm/decoder.js
generated
vendored
271
node_modules/@webassemblyjs/wasm-parser/esm/decoder.js
generated
vendored
@@ -345,7 +345,13 @@ export function decode(ab, opts) {
|
||||
if (type == constants.types.func) {
|
||||
dump([type], "func");
|
||||
var paramValtypes = parseVec(function (b) {
|
||||
return constants.valtypes[b];
|
||||
var valtype = constants.valtypes[b];
|
||||
|
||||
if (valtype === undefined) {
|
||||
throw new Error("unexpected value type ".concat(b));
|
||||
}
|
||||
|
||||
return valtype;
|
||||
});
|
||||
var params = paramValtypes.map(function (v) {
|
||||
return t.funcParam(
|
||||
@@ -574,10 +580,7 @@ export function decode(ab, opts) {
|
||||
var bodySizeU32 = readU32();
|
||||
eatBytes(bodySizeU32.nextIndex);
|
||||
dump([bodySizeU32.value], "function body size");
|
||||
var code = [];
|
||||
/**
|
||||
* Parse locals
|
||||
*/
|
||||
var code = []; // Parse locals
|
||||
|
||||
var funcLocalNumU32 = readU32();
|
||||
var funcLocalNum = funcLocalNumU32.value;
|
||||
@@ -639,6 +642,13 @@ export function decode(ab, opts) {
|
||||
if (instructionByte === 0xfe) {
|
||||
instructionByte = 0xfe00 + readByte();
|
||||
eatBytes(1);
|
||||
} // Table instructions
|
||||
// https://webassembly.github.io/spec/core/binary/instructions.html#table-instructions
|
||||
|
||||
|
||||
if (instructionByte === 0xfc) {
|
||||
instructionByte = 0xfc00 + readByte();
|
||||
eatBytes(1);
|
||||
}
|
||||
|
||||
var instruction = constants.symbolsByByte[instructionByte];
|
||||
@@ -647,6 +657,10 @@ export function decode(ab, opts) {
|
||||
throw new CompileError("Unexpected instruction: " + toHex(instructionByte));
|
||||
}
|
||||
|
||||
if (instruction === "illegal") {
|
||||
throw new Error("tried to decode an illegal bytecode: ".concat(toHex(instructionByte)));
|
||||
}
|
||||
|
||||
if (typeof instruction.object === "string") {
|
||||
dump([instructionByte], "".concat(instruction.object, ".").concat(instruction.name));
|
||||
} else {
|
||||
@@ -673,15 +687,7 @@ export function decode(ab, opts) {
|
||||
if (instruction.name === "loop") {
|
||||
var _startLoc7 = getPosition();
|
||||
|
||||
var blocktypeByte = readByte();
|
||||
eatBytes(1);
|
||||
var blocktype = constants.blockTypes[blocktypeByte];
|
||||
dump([blocktypeByte], "blocktype");
|
||||
|
||||
if (typeof blocktype === "undefined") {
|
||||
throw new CompileError("Unexpected blocktype: " + toHex(blocktypeByte));
|
||||
}
|
||||
|
||||
var blocktype = parseBlockType();
|
||||
var instr = [];
|
||||
parseInstructionBlock(instr); // preserve anonymous
|
||||
|
||||
@@ -697,15 +703,7 @@ export function decode(ab, opts) {
|
||||
} else if (instruction.name === "if") {
|
||||
var _startLoc8 = getPosition();
|
||||
|
||||
var _blocktypeByte = readByte();
|
||||
|
||||
eatBytes(1);
|
||||
var _blocktype = constants.blockTypes[_blocktypeByte];
|
||||
dump([_blocktypeByte], "blocktype");
|
||||
|
||||
if (typeof _blocktype === "undefined") {
|
||||
throw new CompileError("Unexpected blocktype: " + toHex(_blocktypeByte));
|
||||
}
|
||||
var _blocktype = parseBlockType();
|
||||
|
||||
var testIndex = t.withRaw(t.identifier(getUniqueName("if")), "");
|
||||
var ifBody = [];
|
||||
@@ -736,15 +734,7 @@ export function decode(ab, opts) {
|
||||
} else if (instruction.name === "block") {
|
||||
var _startLoc9 = getPosition();
|
||||
|
||||
var _blocktypeByte2 = readByte();
|
||||
|
||||
eatBytes(1);
|
||||
var _blocktype2 = constants.blockTypes[_blocktypeByte2];
|
||||
dump([_blocktypeByte2], "blocktype");
|
||||
|
||||
if (typeof _blocktype2 === "undefined") {
|
||||
throw new CompileError("Unexpected blocktype: " + toHex(_blocktypeByte2));
|
||||
}
|
||||
var _blocktype2 = parseBlockType();
|
||||
|
||||
var _instr2 = [];
|
||||
parseInstructionBlock(_instr2); // preserve anonymous
|
||||
@@ -995,7 +985,7 @@ export function decode(ab, opts) {
|
||||
var elementType = constants.tableTypes[elementTypeByte];
|
||||
|
||||
if (typeof elementType === "undefined") {
|
||||
throw new CompileError("Unknown element type in table: " + toHex(elementType));
|
||||
throw new CompileError("Unknown element type in table: " + toHex(elementTypeByte));
|
||||
}
|
||||
|
||||
var limits = parseLimits();
|
||||
@@ -1201,39 +1191,176 @@ export function decode(ab, opts) {
|
||||
var _startLoc12 = getPosition();
|
||||
|
||||
var tableindexu32 = readU32();
|
||||
var tableindex = tableindexu32.value;
|
||||
var bitfield = tableindexu32.value;
|
||||
eatBytes(tableindexu32.nextIndex);
|
||||
dump([tableindex], "table index");
|
||||
/**
|
||||
* Parse instructions
|
||||
*/
|
||||
dump([bitfield], "bitfield");
|
||||
|
||||
var instr = [];
|
||||
parseInstructionBlock(instr);
|
||||
/**
|
||||
* Parse ( vector function index ) *
|
||||
*/
|
||||
if (bitfield === 0) {
|
||||
// Parse instructions
|
||||
var instr = [];
|
||||
parseInstructionBlock(instr); // Parse ( vector function index ) *
|
||||
|
||||
var indicesu32 = readU32();
|
||||
var indices = indicesu32.value;
|
||||
eatBytes(indicesu32.nextIndex);
|
||||
dump([indices], "num indices");
|
||||
var indexValues = [];
|
||||
var indicesu32 = readU32();
|
||||
var indices = indicesu32.value;
|
||||
eatBytes(indicesu32.nextIndex);
|
||||
dump([indices], "num indices");
|
||||
var indexValues = [];
|
||||
|
||||
for (var _i5 = 0; _i5 < indices; _i5++) {
|
||||
var indexu32 = readU32();
|
||||
var index = indexu32.value;
|
||||
eatBytes(indexu32.nextIndex);
|
||||
dump([index], "index");
|
||||
indexValues.push(t.indexLiteral(index));
|
||||
for (var _i5 = 0; _i5 < indices; _i5++) {
|
||||
var indexu32 = readU32();
|
||||
var index = indexu32.value;
|
||||
eatBytes(indexu32.nextIndex);
|
||||
dump([index], "index");
|
||||
indexValues.push(t.indexLiteral(index));
|
||||
}
|
||||
|
||||
var elemNode = function () {
|
||||
var endLoc = getPosition();
|
||||
return t.withLoc(t.elem(t.indexLiteral(bitfield), instr, indexValues), endLoc, _startLoc12);
|
||||
}();
|
||||
|
||||
elems.push(elemNode);
|
||||
} else if (bitfield === 1) {
|
||||
var elemKind = readByte();
|
||||
eatBytes(1);
|
||||
|
||||
if (elemKind !== 0) {
|
||||
throw new Error("unexpected Elem kind: ".concat(toHex(elemKind)));
|
||||
} // Parse ( vector function index ) *
|
||||
|
||||
|
||||
var _indicesu = readU32();
|
||||
|
||||
var _indices = _indicesu.value;
|
||||
eatBytes(_indicesu.nextIndex);
|
||||
dump([_indices], "num indices");
|
||||
var _indexValues = [];
|
||||
|
||||
for (var _i6 = 0; _i6 < _indices; _i6++) {
|
||||
var _indexu2 = readU32();
|
||||
|
||||
var _index3 = _indexu2.value;
|
||||
eatBytes(_indexu2.nextIndex);
|
||||
dump([_index3], "index");
|
||||
|
||||
_indexValues.push(t.indexLiteral(_index3));
|
||||
} // TODO: emit a AST node, for now just make it parse.
|
||||
|
||||
} else if (bitfield === 2) {
|
||||
var u32 = readU32();
|
||||
var tableidx = u32.value;
|
||||
eatBytes(u32.nextIndex);
|
||||
dump([tableidx], "tableidx"); // Parse instructions
|
||||
|
||||
var _instr3 = [];
|
||||
parseInstructionBlock(_instr3);
|
||||
|
||||
var _elemKind = readByte();
|
||||
|
||||
eatBytes(1);
|
||||
|
||||
if (_elemKind !== 0) {
|
||||
throw new Error("unexpected Elem kind: ".concat(toHex(_elemKind)));
|
||||
} // Parse ( vector function index ) *
|
||||
|
||||
|
||||
var _indicesu2 = readU32();
|
||||
|
||||
var _indices2 = _indicesu2.value;
|
||||
eatBytes(_indicesu2.nextIndex);
|
||||
dump([_indices2], "num indices");
|
||||
var _indexValues2 = [];
|
||||
|
||||
for (var _i7 = 0; _i7 < _indices2; _i7++) {
|
||||
var _indexu3 = readU32();
|
||||
|
||||
var _index4 = _indexu3.value;
|
||||
eatBytes(_indexu3.nextIndex);
|
||||
dump([_index4], "index");
|
||||
|
||||
_indexValues2.push(t.indexLiteral(_index4));
|
||||
}
|
||||
|
||||
var _elemNode = function () {
|
||||
var endLoc = getPosition();
|
||||
return t.withLoc(t.elem(t.indexLiteral(bitfield), _instr3, _indexValues2), endLoc, _startLoc12);
|
||||
}();
|
||||
|
||||
elems.push(_elemNode);
|
||||
} else if (bitfield === 3) {
|
||||
var _elemKind2 = readByte();
|
||||
|
||||
eatBytes(1);
|
||||
|
||||
if (_elemKind2 !== 0) {
|
||||
throw new Error("unexpected Elem kind: ".concat(toHex(_elemKind2)));
|
||||
} // Parse ( vector function index ) *
|
||||
|
||||
|
||||
var countU32 = readU32();
|
||||
var count = countU32.value;
|
||||
eatBytes(countU32.nextIndex);
|
||||
dump([count], "count");
|
||||
|
||||
for (var _i8 = 0; _i8 < count; _i8++) {
|
||||
var _indexu4 = readU32();
|
||||
|
||||
var _index5 = _indexu4.value;
|
||||
eatBytes(_indexu4.nextIndex);
|
||||
dump([_index5], "index");
|
||||
} // TODO: emit a AST node, for now just make it parse.
|
||||
|
||||
} else if (bitfield === 4) {
|
||||
var expr = [];
|
||||
parseInstructionBlock(expr);
|
||||
|
||||
var _countU = readU32();
|
||||
|
||||
var _count = _countU.value;
|
||||
eatBytes(_countU.nextIndex);
|
||||
dump([_count], "count");
|
||||
|
||||
for (var _i9 = 0; _i9 < _count; _i9++) {
|
||||
var code = [];
|
||||
parseInstructionBlock(code);
|
||||
} // TODO: emit a AST node, for now just make it parse.
|
||||
|
||||
} else if (bitfield === 5) {
|
||||
var reftype = readByte();
|
||||
eatBytes(1);
|
||||
dump([reftype], "reftype");
|
||||
|
||||
var _countU2 = readU32();
|
||||
|
||||
var _count2 = _countU2.value;
|
||||
eatBytes(_countU2.nextIndex);
|
||||
dump([_count2], "count");
|
||||
|
||||
for (var _i10 = 0; _i10 < _count2; _i10++) {
|
||||
var _code = [];
|
||||
parseInstructionBlock(_code);
|
||||
} // TODO: emit a AST node, for now just make it parse.
|
||||
|
||||
} else if (bitfield === 7) {
|
||||
var _reftype = readByte();
|
||||
|
||||
eatBytes(1);
|
||||
dump([_reftype], "reftype");
|
||||
|
||||
var _countU3 = readU32();
|
||||
|
||||
var _count3 = _countU3.value;
|
||||
eatBytes(_countU3.nextIndex);
|
||||
dump([_count3], "count");
|
||||
|
||||
for (var _i11 = 0; _i11 < _count3; _i11++) {
|
||||
var _code2 = [];
|
||||
parseInstructionBlock(_code2);
|
||||
} // TODO: emit a AST node, for now just make it parse.
|
||||
|
||||
} else {
|
||||
throw new Error("unexpected Elem with bitfield ".concat(toHex(bitfield)));
|
||||
}
|
||||
|
||||
var elemNode = function () {
|
||||
var endLoc = getPosition();
|
||||
return t.withLoc(t.elem(t.indexLiteral(tableindex), instr, indexValues), endLoc, _startLoc12);
|
||||
}();
|
||||
|
||||
elems.push(elemNode);
|
||||
}
|
||||
|
||||
return elems;
|
||||
@@ -1702,6 +1829,28 @@ export function decode(ab, opts) {
|
||||
}
|
||||
}
|
||||
|
||||
function parseBlockType() {
|
||||
var blocktypeByte = readByte();
|
||||
var blocktype = constants.blockTypes[blocktypeByte];
|
||||
|
||||
if (typeof blocktype !== "undefined") {
|
||||
eatBytes(1);
|
||||
dump([blocktypeByte], "blocktype"); // value type
|
||||
|
||||
return blocktype;
|
||||
} else {
|
||||
// type index
|
||||
var u32 = readU32();
|
||||
eatBytes(u32.nextIndex);
|
||||
var signature = state.typesInModule[u32.value];
|
||||
console.log({
|
||||
signature: signature
|
||||
});
|
||||
dump([u32.value], "typeidx");
|
||||
return u32.value;
|
||||
}
|
||||
}
|
||||
|
||||
parseModuleHeader();
|
||||
parseVersion();
|
||||
var moduleFields = [];
|
||||
|
||||
271
node_modules/@webassemblyjs/wasm-parser/lib/decoder.js
generated
vendored
271
node_modules/@webassemblyjs/wasm-parser/lib/decoder.js
generated
vendored
@@ -365,7 +365,13 @@ function decode(ab, opts) {
|
||||
if (type == _helperWasmBytecode["default"].types.func) {
|
||||
dump([type], "func");
|
||||
var paramValtypes = parseVec(function (b) {
|
||||
return _helperWasmBytecode["default"].valtypes[b];
|
||||
var valtype = _helperWasmBytecode["default"].valtypes[b];
|
||||
|
||||
if (valtype === undefined) {
|
||||
throw new Error("unexpected value type ".concat(b));
|
||||
}
|
||||
|
||||
return valtype;
|
||||
});
|
||||
var params = paramValtypes.map(function (v) {
|
||||
return t.funcParam(
|
||||
@@ -594,10 +600,7 @@ function decode(ab, opts) {
|
||||
var bodySizeU32 = readU32();
|
||||
eatBytes(bodySizeU32.nextIndex);
|
||||
dump([bodySizeU32.value], "function body size");
|
||||
var code = [];
|
||||
/**
|
||||
* Parse locals
|
||||
*/
|
||||
var code = []; // Parse locals
|
||||
|
||||
var funcLocalNumU32 = readU32();
|
||||
var funcLocalNum = funcLocalNumU32.value;
|
||||
@@ -659,6 +662,13 @@ function decode(ab, opts) {
|
||||
if (instructionByte === 0xfe) {
|
||||
instructionByte = 0xfe00 + readByte();
|
||||
eatBytes(1);
|
||||
} // Table instructions
|
||||
// https://webassembly.github.io/spec/core/binary/instructions.html#table-instructions
|
||||
|
||||
|
||||
if (instructionByte === 0xfc) {
|
||||
instructionByte = 0xfc00 + readByte();
|
||||
eatBytes(1);
|
||||
}
|
||||
|
||||
var instruction = _helperWasmBytecode["default"].symbolsByByte[instructionByte];
|
||||
@@ -667,6 +677,10 @@ function decode(ab, opts) {
|
||||
throw new _helperApiError.CompileError("Unexpected instruction: " + toHex(instructionByte));
|
||||
}
|
||||
|
||||
if (instruction === "illegal") {
|
||||
throw new Error("tried to decode an illegal bytecode: ".concat(toHex(instructionByte)));
|
||||
}
|
||||
|
||||
if (typeof instruction.object === "string") {
|
||||
dump([instructionByte], "".concat(instruction.object, ".").concat(instruction.name));
|
||||
} else {
|
||||
@@ -693,15 +707,7 @@ function decode(ab, opts) {
|
||||
if (instruction.name === "loop") {
|
||||
var _startLoc7 = getPosition();
|
||||
|
||||
var blocktypeByte = readByte();
|
||||
eatBytes(1);
|
||||
var blocktype = _helperWasmBytecode["default"].blockTypes[blocktypeByte];
|
||||
dump([blocktypeByte], "blocktype");
|
||||
|
||||
if (typeof blocktype === "undefined") {
|
||||
throw new _helperApiError.CompileError("Unexpected blocktype: " + toHex(blocktypeByte));
|
||||
}
|
||||
|
||||
var blocktype = parseBlockType();
|
||||
var instr = [];
|
||||
parseInstructionBlock(instr); // preserve anonymous
|
||||
|
||||
@@ -717,15 +723,7 @@ function decode(ab, opts) {
|
||||
} else if (instruction.name === "if") {
|
||||
var _startLoc8 = getPosition();
|
||||
|
||||
var _blocktypeByte = readByte();
|
||||
|
||||
eatBytes(1);
|
||||
var _blocktype = _helperWasmBytecode["default"].blockTypes[_blocktypeByte];
|
||||
dump([_blocktypeByte], "blocktype");
|
||||
|
||||
if (typeof _blocktype === "undefined") {
|
||||
throw new _helperApiError.CompileError("Unexpected blocktype: " + toHex(_blocktypeByte));
|
||||
}
|
||||
var _blocktype = parseBlockType();
|
||||
|
||||
var testIndex = t.withRaw(t.identifier(getUniqueName("if")), "");
|
||||
var ifBody = [];
|
||||
@@ -756,15 +754,7 @@ function decode(ab, opts) {
|
||||
} else if (instruction.name === "block") {
|
||||
var _startLoc9 = getPosition();
|
||||
|
||||
var _blocktypeByte2 = readByte();
|
||||
|
||||
eatBytes(1);
|
||||
var _blocktype2 = _helperWasmBytecode["default"].blockTypes[_blocktypeByte2];
|
||||
dump([_blocktypeByte2], "blocktype");
|
||||
|
||||
if (typeof _blocktype2 === "undefined") {
|
||||
throw new _helperApiError.CompileError("Unexpected blocktype: " + toHex(_blocktypeByte2));
|
||||
}
|
||||
var _blocktype2 = parseBlockType();
|
||||
|
||||
var _instr2 = [];
|
||||
parseInstructionBlock(_instr2); // preserve anonymous
|
||||
@@ -1015,7 +1005,7 @@ function decode(ab, opts) {
|
||||
var elementType = _helperWasmBytecode["default"].tableTypes[elementTypeByte];
|
||||
|
||||
if (typeof elementType === "undefined") {
|
||||
throw new _helperApiError.CompileError("Unknown element type in table: " + toHex(elementType));
|
||||
throw new _helperApiError.CompileError("Unknown element type in table: " + toHex(elementTypeByte));
|
||||
}
|
||||
|
||||
var limits = parseLimits();
|
||||
@@ -1221,39 +1211,176 @@ function decode(ab, opts) {
|
||||
var _startLoc12 = getPosition();
|
||||
|
||||
var tableindexu32 = readU32();
|
||||
var tableindex = tableindexu32.value;
|
||||
var bitfield = tableindexu32.value;
|
||||
eatBytes(tableindexu32.nextIndex);
|
||||
dump([tableindex], "table index");
|
||||
/**
|
||||
* Parse instructions
|
||||
*/
|
||||
dump([bitfield], "bitfield");
|
||||
|
||||
var instr = [];
|
||||
parseInstructionBlock(instr);
|
||||
/**
|
||||
* Parse ( vector function index ) *
|
||||
*/
|
||||
if (bitfield === 0) {
|
||||
// Parse instructions
|
||||
var instr = [];
|
||||
parseInstructionBlock(instr); // Parse ( vector function index ) *
|
||||
|
||||
var indicesu32 = readU32();
|
||||
var indices = indicesu32.value;
|
||||
eatBytes(indicesu32.nextIndex);
|
||||
dump([indices], "num indices");
|
||||
var indexValues = [];
|
||||
var indicesu32 = readU32();
|
||||
var indices = indicesu32.value;
|
||||
eatBytes(indicesu32.nextIndex);
|
||||
dump([indices], "num indices");
|
||||
var indexValues = [];
|
||||
|
||||
for (var _i5 = 0; _i5 < indices; _i5++) {
|
||||
var indexu32 = readU32();
|
||||
var index = indexu32.value;
|
||||
eatBytes(indexu32.nextIndex);
|
||||
dump([index], "index");
|
||||
indexValues.push(t.indexLiteral(index));
|
||||
for (var _i5 = 0; _i5 < indices; _i5++) {
|
||||
var indexu32 = readU32();
|
||||
var index = indexu32.value;
|
||||
eatBytes(indexu32.nextIndex);
|
||||
dump([index], "index");
|
||||
indexValues.push(t.indexLiteral(index));
|
||||
}
|
||||
|
||||
var elemNode = function () {
|
||||
var endLoc = getPosition();
|
||||
return t.withLoc(t.elem(t.indexLiteral(bitfield), instr, indexValues), endLoc, _startLoc12);
|
||||
}();
|
||||
|
||||
elems.push(elemNode);
|
||||
} else if (bitfield === 1) {
|
||||
var elemKind = readByte();
|
||||
eatBytes(1);
|
||||
|
||||
if (elemKind !== 0) {
|
||||
throw new Error("unexpected Elem kind: ".concat(toHex(elemKind)));
|
||||
} // Parse ( vector function index ) *
|
||||
|
||||
|
||||
var _indicesu = readU32();
|
||||
|
||||
var _indices = _indicesu.value;
|
||||
eatBytes(_indicesu.nextIndex);
|
||||
dump([_indices], "num indices");
|
||||
var _indexValues = [];
|
||||
|
||||
for (var _i6 = 0; _i6 < _indices; _i6++) {
|
||||
var _indexu2 = readU32();
|
||||
|
||||
var _index3 = _indexu2.value;
|
||||
eatBytes(_indexu2.nextIndex);
|
||||
dump([_index3], "index");
|
||||
|
||||
_indexValues.push(t.indexLiteral(_index3));
|
||||
} // TODO: emit a AST node, for now just make it parse.
|
||||
|
||||
} else if (bitfield === 2) {
|
||||
var u32 = readU32();
|
||||
var tableidx = u32.value;
|
||||
eatBytes(u32.nextIndex);
|
||||
dump([tableidx], "tableidx"); // Parse instructions
|
||||
|
||||
var _instr3 = [];
|
||||
parseInstructionBlock(_instr3);
|
||||
|
||||
var _elemKind = readByte();
|
||||
|
||||
eatBytes(1);
|
||||
|
||||
if (_elemKind !== 0) {
|
||||
throw new Error("unexpected Elem kind: ".concat(toHex(_elemKind)));
|
||||
} // Parse ( vector function index ) *
|
||||
|
||||
|
||||
var _indicesu2 = readU32();
|
||||
|
||||
var _indices2 = _indicesu2.value;
|
||||
eatBytes(_indicesu2.nextIndex);
|
||||
dump([_indices2], "num indices");
|
||||
var _indexValues2 = [];
|
||||
|
||||
for (var _i7 = 0; _i7 < _indices2; _i7++) {
|
||||
var _indexu3 = readU32();
|
||||
|
||||
var _index4 = _indexu3.value;
|
||||
eatBytes(_indexu3.nextIndex);
|
||||
dump([_index4], "index");
|
||||
|
||||
_indexValues2.push(t.indexLiteral(_index4));
|
||||
}
|
||||
|
||||
var _elemNode = function () {
|
||||
var endLoc = getPosition();
|
||||
return t.withLoc(t.elem(t.indexLiteral(bitfield), _instr3, _indexValues2), endLoc, _startLoc12);
|
||||
}();
|
||||
|
||||
elems.push(_elemNode);
|
||||
} else if (bitfield === 3) {
|
||||
var _elemKind2 = readByte();
|
||||
|
||||
eatBytes(1);
|
||||
|
||||
if (_elemKind2 !== 0) {
|
||||
throw new Error("unexpected Elem kind: ".concat(toHex(_elemKind2)));
|
||||
} // Parse ( vector function index ) *
|
||||
|
||||
|
||||
var countU32 = readU32();
|
||||
var count = countU32.value;
|
||||
eatBytes(countU32.nextIndex);
|
||||
dump([count], "count");
|
||||
|
||||
for (var _i8 = 0; _i8 < count; _i8++) {
|
||||
var _indexu4 = readU32();
|
||||
|
||||
var _index5 = _indexu4.value;
|
||||
eatBytes(_indexu4.nextIndex);
|
||||
dump([_index5], "index");
|
||||
} // TODO: emit a AST node, for now just make it parse.
|
||||
|
||||
} else if (bitfield === 4) {
|
||||
var expr = [];
|
||||
parseInstructionBlock(expr);
|
||||
|
||||
var _countU = readU32();
|
||||
|
||||
var _count = _countU.value;
|
||||
eatBytes(_countU.nextIndex);
|
||||
dump([_count], "count");
|
||||
|
||||
for (var _i9 = 0; _i9 < _count; _i9++) {
|
||||
var code = [];
|
||||
parseInstructionBlock(code);
|
||||
} // TODO: emit a AST node, for now just make it parse.
|
||||
|
||||
} else if (bitfield === 5) {
|
||||
var reftype = readByte();
|
||||
eatBytes(1);
|
||||
dump([reftype], "reftype");
|
||||
|
||||
var _countU2 = readU32();
|
||||
|
||||
var _count2 = _countU2.value;
|
||||
eatBytes(_countU2.nextIndex);
|
||||
dump([_count2], "count");
|
||||
|
||||
for (var _i10 = 0; _i10 < _count2; _i10++) {
|
||||
var _code = [];
|
||||
parseInstructionBlock(_code);
|
||||
} // TODO: emit a AST node, for now just make it parse.
|
||||
|
||||
} else if (bitfield === 7) {
|
||||
var _reftype = readByte();
|
||||
|
||||
eatBytes(1);
|
||||
dump([_reftype], "reftype");
|
||||
|
||||
var _countU3 = readU32();
|
||||
|
||||
var _count3 = _countU3.value;
|
||||
eatBytes(_countU3.nextIndex);
|
||||
dump([_count3], "count");
|
||||
|
||||
for (var _i11 = 0; _i11 < _count3; _i11++) {
|
||||
var _code2 = [];
|
||||
parseInstructionBlock(_code2);
|
||||
} // TODO: emit a AST node, for now just make it parse.
|
||||
|
||||
} else {
|
||||
throw new Error("unexpected Elem with bitfield ".concat(toHex(bitfield)));
|
||||
}
|
||||
|
||||
var elemNode = function () {
|
||||
var endLoc = getPosition();
|
||||
return t.withLoc(t.elem(t.indexLiteral(tableindex), instr, indexValues), endLoc, _startLoc12);
|
||||
}();
|
||||
|
||||
elems.push(elemNode);
|
||||
}
|
||||
|
||||
return elems;
|
||||
@@ -1722,6 +1849,28 @@ function decode(ab, opts) {
|
||||
}
|
||||
}
|
||||
|
||||
function parseBlockType() {
|
||||
var blocktypeByte = readByte();
|
||||
var blocktype = _helperWasmBytecode["default"].blockTypes[blocktypeByte];
|
||||
|
||||
if (typeof blocktype !== "undefined") {
|
||||
eatBytes(1);
|
||||
dump([blocktypeByte], "blocktype"); // value type
|
||||
|
||||
return blocktype;
|
||||
} else {
|
||||
// type index
|
||||
var u32 = readU32();
|
||||
eatBytes(u32.nextIndex);
|
||||
var signature = state.typesInModule[u32.value];
|
||||
console.log({
|
||||
signature: signature
|
||||
});
|
||||
dump([u32.value], "typeidx");
|
||||
return u32.value;
|
||||
}
|
||||
}
|
||||
|
||||
parseModuleHeader();
|
||||
parseVersion();
|
||||
var moduleFields = [];
|
||||
|
||||
26
node_modules/@webassemblyjs/wasm-parser/package.json
generated
vendored
26
node_modules/@webassemblyjs/wasm-parser/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@webassemblyjs/wasm-parser",
|
||||
"version": "1.12.1",
|
||||
"version": "1.14.1",
|
||||
"keywords": [
|
||||
"webassembly",
|
||||
"javascript",
|
||||
@@ -17,12 +17,12 @@
|
||||
"author": "Sven Sauleau",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@webassemblyjs/ast": "1.12.1",
|
||||
"@webassemblyjs/helper-api-error": "1.11.6",
|
||||
"@webassemblyjs/helper-wasm-bytecode": "1.11.6",
|
||||
"@webassemblyjs/ieee754": "1.11.6",
|
||||
"@webassemblyjs/leb128": "1.11.6",
|
||||
"@webassemblyjs/utf8": "1.11.6"
|
||||
"@webassemblyjs/ast": "1.14.1",
|
||||
"@webassemblyjs/helper-api-error": "1.13.2",
|
||||
"@webassemblyjs/helper-wasm-bytecode": "1.13.2",
|
||||
"@webassemblyjs/ieee754": "1.13.2",
|
||||
"@webassemblyjs/leb128": "1.13.2",
|
||||
"@webassemblyjs/utf8": "1.13.2"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -32,13 +32,13 @@
|
||||
"access": "public"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@webassemblyjs/helper-buffer": "1.12.1",
|
||||
"@webassemblyjs/helper-test-framework": "1.12.1",
|
||||
"@webassemblyjs/helper-wasm-bytecode": "1.7.7",
|
||||
"@webassemblyjs/wasm-gen": "1.12.1",
|
||||
"@webassemblyjs/wast-parser": "1.12.1",
|
||||
"@webassemblyjs/helper-buffer": "1.14.1",
|
||||
"@webassemblyjs/helper-test-framework": "1.14.1",
|
||||
"@webassemblyjs/helper-wasm-bytecode": "1.13.2",
|
||||
"@webassemblyjs/wasm-gen": "1.14.1",
|
||||
"@webassemblyjs/wast-parser": "1.14.1",
|
||||
"mamacro": "^0.0.7",
|
||||
"wabt": "1.0.12"
|
||||
},
|
||||
"gitHead": "67c75cf2da65e5588b5e81c10b0d7692d174760b"
|
||||
"gitHead": "25d52b1296e151ac56244a7c3886661e6b4a69ea"
|
||||
}
|
||||
|
||||
10
node_modules/@webassemblyjs/wast-printer/package.json
generated
vendored
10
node_modules/@webassemblyjs/wast-printer/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@webassemblyjs/wast-printer",
|
||||
"version": "1.12.1",
|
||||
"version": "1.14.1",
|
||||
"description": "WebAssembly text format printer",
|
||||
"main": "lib/index.js",
|
||||
"module": "esm/index.js",
|
||||
@@ -18,12 +18,12 @@
|
||||
"author": "Sven Sauleau",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@webassemblyjs/ast": "1.12.1",
|
||||
"@webassemblyjs/ast": "1.14.1",
|
||||
"@xtuc/long": "4.2.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@webassemblyjs/helper-test-framework": "1.12.1",
|
||||
"@webassemblyjs/wast-parser": "1.12.1"
|
||||
"@webassemblyjs/helper-test-framework": "1.14.1",
|
||||
"@webassemblyjs/wast-parser": "1.14.1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -32,5 +32,5 @@
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "67c75cf2da65e5588b5e81c10b0d7692d174760b"
|
||||
"gitHead": "25d52b1296e151ac56244a7c3886661e6b4a69ea"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user