wasmparser
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -0,1 +1,8 @@ | ||
# [2.1.0](https://github.com/wasdk/wasmparser/compare/v2.0.0...v2.1.0) (2020-06-10) | ||
### Features | ||
* use abbreviated syntax for all imports ([39ee77c](https://github.com/wasdk/wasmparser/commit/39ee77ce42f579fc7e0e21c73d0eb9158cc20753)), closes [#56](https://github.com/wasdk/wasmparser/issues/56) | ||
# [2.0.0](https://github.com/wasdk/wasmparser/compare/v1.0.0...v2.0.0) (2020-06-10) | ||
@@ -2,0 +9,0 @@ |
@@ -209,5 +209,4 @@ "use strict"; | ||
function globalTypeToString(type) { | ||
if (!type.mutability) | ||
return typeToString(type.contentType); | ||
return "(mut " + typeToString(type.contentType) + ")"; | ||
var typeStr = typeToString(type.contentType); | ||
return type.mutability ? "(mut " + typeStr + ")" : typeStr; | ||
} | ||
@@ -924,4 +923,2 @@ function limitsToString(limits) { | ||
importInfo = reader.result; | ||
this_1.appendBuffer(' (import '); | ||
this_1.printImportSource(importInfo); | ||
switch (importInfo.kind) { | ||
@@ -931,3 +928,5 @@ case 0 /* Function */: | ||
funcName = this_1._nameResolver.getFunctionName(this_1._funcIndex++, true, false); | ||
this_1.appendBuffer(" (func " + funcName); | ||
this_1.appendBuffer(" (func " + funcName + " (import "); | ||
this_1.printImportSource(importInfo); | ||
this_1.appendBuffer(')'); | ||
this_1.printFuncType(importInfo.funcTypeIndex); | ||
@@ -939,3 +938,5 @@ this_1.appendBuffer(')'); | ||
tableName = this_1._nameResolver.getTableName(this_1._tableCount++, false); | ||
this_1.appendBuffer(" (table " + tableName + " " + limitsToString(tableImportInfo.limits) + " " + typeToString(tableImportInfo.elementType) + ")"); | ||
this_1.appendBuffer(" (table " + tableName + " (import "); | ||
this_1.printImportSource(importInfo); | ||
this_1.appendBuffer(") " + limitsToString(tableImportInfo.limits) + " " + typeToString(tableImportInfo.elementType) + ")"); | ||
break; | ||
@@ -945,9 +946,8 @@ case 2 /* Memory */: | ||
memoryName = this_1._nameResolver.getMemoryName(this_1._memoryCount++, false); | ||
this_1.appendBuffer(" (memory " + memoryName + " "); | ||
this_1.appendBuffer(" (memory " + memoryName + " (import "); | ||
this_1.printImportSource(importInfo); | ||
this_1.appendBuffer(") " + limitsToString(memoryImportInfo.limits)); | ||
if (memoryImportInfo.shared) { | ||
this_1.appendBuffer(limitsToString(memoryImportInfo.limits) + " shared"); | ||
this_1.appendBuffer(" shared"); | ||
} | ||
else { | ||
this_1.appendBuffer(limitsToString(memoryImportInfo.limits)); | ||
} | ||
this_1.appendBuffer(')'); | ||
@@ -958,3 +958,5 @@ break; | ||
globalName = this_1._nameResolver.getGlobalName(this_1._globalCount++, false); | ||
this_1.appendBuffer(" (global " + globalName + " " + globalTypeToString(globalImportInfo) + ")"); | ||
this_1.appendBuffer(" (global " + globalName + " (import "); | ||
this_1.printImportSource(importInfo); | ||
this_1.appendBuffer(") " + globalTypeToString(globalImportInfo) + ")"); | ||
break; | ||
@@ -964,3 +966,2 @@ default: | ||
} | ||
this_1.appendBuffer(')'); | ||
this_1.newLine(); | ||
@@ -967,0 +968,0 @@ break; |
@@ -194,5 +194,4 @@ /* Copyright 2016 Mozilla Foundation | ||
function globalTypeToString(type) { | ||
if (!type.mutability) | ||
return typeToString(type.contentType); | ||
return `(mut ${typeToString(type.contentType)})`; | ||
const typeStr = typeToString(type.contentType); | ||
return type.mutability ? `(mut ${typeStr})` : typeStr; | ||
} | ||
@@ -874,4 +873,2 @@ function limitsToString(limits) { | ||
var importInfo = reader.result; | ||
this.appendBuffer(' (import '); | ||
this.printImportSource(importInfo); | ||
switch (importInfo.kind) { | ||
@@ -881,3 +878,5 @@ case 0 /* Function */: | ||
var funcName = this._nameResolver.getFunctionName(this._funcIndex++, true, false); | ||
this.appendBuffer(` (func ${funcName}`); | ||
this.appendBuffer(` (func ${funcName} (import `); | ||
this.printImportSource(importInfo); | ||
this.appendBuffer(')'); | ||
this.printFuncType(importInfo.funcTypeIndex); | ||
@@ -889,3 +888,5 @@ this.appendBuffer(')'); | ||
var tableName = this._nameResolver.getTableName(this._tableCount++, false); | ||
this.appendBuffer(` (table ${tableName} ${limitsToString(tableImportInfo.limits)} ${typeToString(tableImportInfo.elementType)})`); | ||
this.appendBuffer(` (table ${tableName} (import `); | ||
this.printImportSource(importInfo); | ||
this.appendBuffer(`) ${limitsToString(tableImportInfo.limits)} ${typeToString(tableImportInfo.elementType)})`); | ||
break; | ||
@@ -895,9 +896,8 @@ case 2 /* Memory */: | ||
var memoryName = this._nameResolver.getMemoryName(this._memoryCount++, false); | ||
this.appendBuffer(` (memory ${memoryName} `); | ||
this.appendBuffer(` (memory ${memoryName} (import `); | ||
this.printImportSource(importInfo); | ||
this.appendBuffer(`) ${limitsToString(memoryImportInfo.limits)}`); | ||
if (memoryImportInfo.shared) { | ||
this.appendBuffer(`${limitsToString(memoryImportInfo.limits)} shared`); | ||
this.appendBuffer(` shared`); | ||
} | ||
else { | ||
this.appendBuffer(limitsToString(memoryImportInfo.limits)); | ||
} | ||
this.appendBuffer(')'); | ||
@@ -908,3 +908,5 @@ break; | ||
var globalName = this._nameResolver.getGlobalName(this._globalCount++, false); | ||
this.appendBuffer(` (global ${globalName} ${globalTypeToString(globalImportInfo)})`); | ||
this.appendBuffer(` (global ${globalName} (import `); | ||
this.printImportSource(importInfo); | ||
this.appendBuffer(`) ${globalTypeToString(globalImportInfo)})`); | ||
break; | ||
@@ -914,3 +916,2 @@ default: | ||
} | ||
this.appendBuffer(')'); | ||
this.newLine(); | ||
@@ -917,0 +918,0 @@ break; |
{ | ||
"name": "wasmparser", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Binary WebAssembly file parser.", | ||
@@ -5,0 +5,0 @@ "main": "dist/cjs/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
749540
11202