Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@webassemblyjs/wast-printer

Package Overview
Dependencies
Maintainers
1
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@webassemblyjs/wast-printer - npm Package Compare versions

Comparing version 1.3.0 to 1.3.1

96

lib/index.js

@@ -283,2 +283,23 @@ "use strict";

function printSignature(n) {
var out = "";
n.params.forEach(function (param) {
out += space;
out += "(";
out += "param";
out += space;
out += printFuncParam(param);
out += ")";
});
n.results.forEach(function (result) {
out += space;
out += "(";
out += "result";
out += space;
out += result;
out += ")";
});
return out;
}
function printModuleImportDescr(n) {

@@ -296,18 +317,3 @@ var out = "";

n.signature.params.forEach(function (param) {
out += space;
out += "(";
out += "param";
out += space;
out += printFuncParam(param);
out += ")";
});
n.signature.results.forEach(function (result) {
out += space;
out += "(";
out += "result";
out += space;
out += result;
out += ")";
});
out += printSignature(n.signature);
out += ")";

@@ -424,19 +430,3 @@ }

if (n.signature.type === "Signature") {
var signature = n.signature;
signature.params.forEach(function (param) {
out += space;
out += "(";
out += "param";
out += space;
out += printFuncParam(param);
out += ")";
});
signature.results.forEach(function (result) {
out += space;
out += "(";
out += "result";
out += space;
out += result;
out += ")";
});
out += printSignature(n.signature);
} else {

@@ -491,2 +481,6 @@ var index = n.signature;

case "CallIndirectInstruction":
// $FlowIgnore
return printCallIndirectIntruction(n, depth + 1);
case "LoopInstruction":

@@ -501,2 +495,38 @@ // $FlowIgnore

function printCallIndirectIntruction(n, depth) {
var out = "";
out += "(";
out += "call_indirect";
if (n.signature.type === "Signature") {
out += printSignature(n.signature);
} else if (n.signature.type === "Identifier") {
out += space;
out += "(";
out += "type";
out += space;
out += printIdentifier(n.signature);
out += ")";
} else {
throw new Error("CallIndirectInstruction: unsupported signature " + JSON.stringify(n.signature.type));
}
out += space;
if (n.intrs != null) {
// $FlowIgnore
n.intrs.forEach(function (i, index) {
// $FlowIgnore
out += printInstruction(i, depth + 1); // $FlowIgnore
if (index !== n.intrs.length - 1) {
out += space;
}
});
}
out += ")";
return out;
}
function printLoopInstruction(n, depth) {

@@ -503,0 +533,0 @@ var out = "";

{
"name": "@webassemblyjs/wast-printer",
"version": "1.3.0",
"version": "1.3.1",
"description": "WebAssembly text format printer",

@@ -20,8 +20,8 @@ "main": "lib/index.js",

"dependencies": {
"@webassemblyjs/ast": "1.3.0",
"@webassemblyjs/wast-parser": "1.3.0",
"@webassemblyjs/ast": "1.3.1",
"@webassemblyjs/wast-parser": "1.3.1",
"long": "^3.2.0"
},
"devDependencies": {
"@webassemblyjs/helper-test-framework": "1.3.0"
"@webassemblyjs/helper-test-framework": "1.3.1"
},

@@ -28,0 +28,0 @@ "repository": {

@@ -292,2 +292,28 @@ // @flow

function printSignature(n: Signature): string {
let out = "";
n.params.forEach(param => {
out += space;
out += "(";
out += "param";
out += space;
out += printFuncParam(param);
out += ")";
});
n.results.forEach(result => {
out += space;
out += "(";
out += "result";
out += space;
out += result;
out += ")";
});
return out;
}
function printModuleImportDescr(n: ImportDescr): string {

@@ -305,22 +331,4 @@ let out = "";

n.signature.params.forEach(param => {
out += space;
out += "(";
out += "param";
out += space;
out += printSignature(n.signature);
out += printFuncParam(param);
out += ")";
});
n.signature.results.forEach(result => {
out += space;
out += "(";
out += "result";
out += space;
out += result;
out += ")";
});
out += ")";

@@ -454,24 +462,3 @@ }

if (n.signature.type === "Signature") {
const signature = (n.signature: Signature);
signature.params.forEach(param => {
out += space;
out += "(";
out += "param";
out += space;
out += printFuncParam(param);
out += ")";
});
signature.results.forEach(result => {
out += space;
out += "(";
out += "result";
out += space;
out += result;
out += ")";
});
out += printSignature(n.signature);
} else {

@@ -529,2 +516,6 @@ const index = (n.signature: Index);

case "CallIndirectInstruction":
// $FlowIgnore
return printCallIndirectIntruction(n, depth + 1);
case "LoopInstruction":

@@ -539,2 +530,50 @@ // $FlowIgnore

function printCallIndirectIntruction(
n: CallIndirectInstruction,
depth: number
): string {
let out = "";
out += "(";
out += "call_indirect";
if (n.signature.type === "Signature") {
out += printSignature(n.signature);
} else if (n.signature.type === "Identifier") {
out += space;
out += "(";
out += "type";
out += space;
out += printIdentifier(n.signature);
out += ")";
} else {
throw new Error(
"CallIndirectInstruction: unsupported signature " +
JSON.stringify(n.signature.type)
);
}
out += space;
if (n.intrs != null) {
// $FlowIgnore
n.intrs.forEach((i, index) => {
// $FlowIgnore
out += printInstruction(i, depth + 1);
// $FlowIgnore
if (index !== n.intrs.length - 1) {
out += space;
}
});
}
out += ")";
return out;
}
function printLoopInstruction(n: LoopInstruction, depth: number): string {

@@ -541,0 +580,0 @@ let out = "";

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc