@webassemblyjs/wasm-gen
Advanced tools
Comparing version 1.1.2-y.0 to 1.1.2-y.1
@@ -13,5 +13,7 @@ "use strict"; | ||
exports.encodeUTF8Vec = encodeUTF8Vec; | ||
exports.encodeLimits = encodeLimits; | ||
exports.encodeModuleImport = encodeModuleImport; | ||
exports.encodeSectionMetadata = encodeSectionMetadata; | ||
exports.encodeCallInstruction = encodeCallInstruction; | ||
exports.encodeCallIndirectInstruction = encodeCallIndirectInstruction; | ||
exports.encodeModuleExport = encodeModuleExport; | ||
@@ -86,2 +88,18 @@ exports.encodeTypeInstruction = encodeTypeInstruction; | ||
function encodeLimits(n) { | ||
var out = []; | ||
if (typeof n.max === "number") { | ||
out.push(0x01); | ||
out.push.apply(out, _toConsumableArray(encodeU32(n.min))); // $FlowIgnore: ensured by the typeof | ||
out.push.apply(out, _toConsumableArray(encodeU32(n.max))); | ||
} else { | ||
out.push(0x00); | ||
out.push.apply(out, _toConsumableArray(encodeU32(n.min))); | ||
} | ||
return out; | ||
} | ||
function encodeModuleImport(n) { | ||
@@ -105,16 +123,15 @@ var out = []; | ||
{ | ||
out.push(0x02); // $FlowIgnore: Memory ensure that these props exists | ||
out.push(0x02); // $FlowIgnore | ||
if (typeof n.descr.limits.max === "number") { | ||
out.push(0x01); // $FlowIgnore: Memory ensure that these props exists | ||
out.push.apply(out, _toConsumableArray(encodeLimits(n.descr.limits))); | ||
break; | ||
} | ||
out.push.apply(out, _toConsumableArray(encodeU32(n.descr.limits.min))); // $FlowIgnore: Memory ensure that these props exists | ||
case "Table": | ||
{ | ||
out.push(0x01); | ||
out.push(0x70); // element type | ||
// $FlowIgnore | ||
out.push.apply(out, _toConsumableArray(encodeU32(n.descr.limits.max))); | ||
} else { | ||
out.push(0x00); // $FlowIgnore: Memory ensure that these props exists | ||
out.push.apply(out, _toConsumableArray(encodeU32(n.descr.limits.min))); | ||
} | ||
out.push.apply(out, _toConsumableArray(encodeLimits(n.descr.limits))); | ||
break; | ||
@@ -171,2 +188,11 @@ } | ||
function encodeCallIndirectInstruction(n) { | ||
var out = []; | ||
assertNotIdentifierNode(n.index); | ||
out.push(0x11); // $FlowIgnore | ||
out.push.apply(out, _toConsumableArray(encodeU32(n.index.value))); | ||
return out; | ||
} | ||
function encodeModuleExport(n) { | ||
@@ -173,0 +199,0 @@ var out = []; |
@@ -27,2 +27,6 @@ "use strict"; | ||
case "CallIndirectInstruction": | ||
// $FlowIgnore: SectionMetadata ensure that the node is well formated | ||
return encoder.encodeCallIndirectInstruction(n); | ||
case "TypeInstruction": | ||
@@ -29,0 +33,0 @@ return encoder.encodeTypeInstruction(n); |
{ | ||
"name": "@webassemblyjs/wasm-gen", | ||
"version": "1.1.2-y.0", | ||
"version": "1.1.2-y.1", | ||
"description": "", | ||
@@ -19,6 +19,6 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@webassemblyjs/ast": "1.1.2-y.0", | ||
"@webassemblyjs/helper-leb128": "1.1.2-y.0", | ||
"@webassemblyjs/helper-wasm-bytecode": "1.1.2-y.0" | ||
"@webassemblyjs/ast": "1.1.2-y.1", | ||
"@webassemblyjs/helper-leb128": "1.1.2-y.1", | ||
"@webassemblyjs/helper-wasm-bytecode": "1.1.2-y.1" | ||
} | ||
} |
@@ -60,2 +60,19 @@ // @flow | ||
export function encodeLimits(n: Limit): Array<Byte> { | ||
const out = []; | ||
if (typeof n.max === "number") { | ||
out.push(0x01); | ||
out.push(...encodeU32(n.min)); | ||
// $FlowIgnore: ensured by the typeof | ||
out.push(...encodeU32(n.max)); | ||
} else { | ||
out.push(0x00); | ||
out.push(...encodeU32(n.min)); | ||
} | ||
return out; | ||
} | ||
export function encodeModuleImport(n: ModuleImport): Array<Byte> { | ||
@@ -81,16 +98,16 @@ const out = []; | ||
// $FlowIgnore: Memory ensure that these props exists | ||
if (typeof n.descr.limits.max === "number") { | ||
out.push(0x01); | ||
// $FlowIgnore | ||
out.push(...encodeLimits(n.descr.limits)); | ||
// $FlowIgnore: Memory ensure that these props exists | ||
out.push(...encodeU32(n.descr.limits.min)); | ||
// $FlowIgnore: Memory ensure that these props exists | ||
out.push(...encodeU32(n.descr.limits.max)); | ||
} else { | ||
out.push(0x00); | ||
break; | ||
} | ||
// $FlowIgnore: Memory ensure that these props exists | ||
out.push(...encodeU32(n.descr.limits.min)); | ||
} | ||
case "Table": { | ||
out.push(0x01); | ||
out.push(0x70); // element type | ||
// $FlowIgnore | ||
out.push(...encodeLimits(n.descr.limits)); | ||
break; | ||
@@ -156,2 +173,14 @@ } | ||
export function encodeCallIndirectInstruction(n: CallInstruction): Array<Byte> { | ||
const out = []; | ||
assertNotIdentifierNode(n.index); | ||
out.push(0x11); | ||
// $FlowIgnore | ||
out.push(...encodeU32(n.index.value)); | ||
return out; | ||
} | ||
export function encodeModuleExport(n: ModuleExport): Array<Byte> { | ||
@@ -158,0 +187,0 @@ const out = []; |
@@ -19,2 +19,6 @@ // @flow | ||
case "CallIndirectInstruction": | ||
// $FlowIgnore: SectionMetadata ensure that the node is well formated | ||
return encoder.encodeCallIndirectInstruction(n); | ||
case "TypeInstruction": | ||
@@ -21,0 +25,0 @@ return encoder.encodeTypeInstruction(n); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14601
384
+ Added@webassemblyjs/ast@1.1.2-y.1(transitive)
+ Added@webassemblyjs/helper-leb128@1.1.2-y.1(transitive)
+ Added@webassemblyjs/helper-wasm-bytecode@1.1.2-y.1(transitive)
+ Added@webassemblyjs/wasm-parser@1.1.2-y.1(transitive)
+ Added@webassemblyjs/wast-parser@1.1.2-y.1(transitive)
+ Addedwebassemblyjs@1.1.2-y.1(transitive)
- Removed@webassemblyjs/ast@1.1.2-y.0(transitive)
- Removed@webassemblyjs/helper-leb128@1.1.2-y.0(transitive)
- Removed@webassemblyjs/helper-wasm-bytecode@1.1.2-y.0(transitive)
- Removed@webassemblyjs/wasm-parser@1.1.2-y.0(transitive)
- Removed@webassemblyjs/wast-parser@1.1.2-y.0(transitive)
- Removedwebassemblyjs@1.1.2-y.0(transitive)
Updated@webassemblyjs/ast@1.1.2-y.1