Skip to content

Commit

Permalink
fix: escape export name strings §6.3.3
Browse files Browse the repository at this point in the history
using JSON.stringify
  • Loading branch information
awt-256 authored and bmeurer committed Sep 15, 2021
1 parent 20a7cf4 commit 1c0d874
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/WasmDis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1209,7 +1209,7 @@ export class WasmDisassembler {
for (const exportName of this._exportMetadata.getMemoryExportNames(
memoryIndex
)) {
this.appendBuffer(` (export "${exportName}")`);
this.appendBuffer(` (export ${JSON.stringify(exportName)})`);
}
}
this.appendBuffer(` ${limitsToString(memoryInfo.limits)}`);
Expand All @@ -1228,7 +1228,7 @@ export class WasmDisassembler {
for (const exportName of this._exportMetadata.getEventExportNames(
eventIndex
)) {
this.appendBuffer(` (export "${exportName}")`);
this.appendBuffer(` (export ${JSON.stringify(exportName)})`);
}
}
this.printFuncType(eventInfo.typeIndex);
Expand All @@ -1244,7 +1244,7 @@ export class WasmDisassembler {
for (const exportName of this._exportMetadata.getTableExportNames(
tableIndex
)) {
this.appendBuffer(` (export "${exportName}")`);
this.appendBuffer(` (export ${JSON.stringify(exportName)})`);
}
}
this.appendBuffer(
Expand Down Expand Up @@ -1322,7 +1322,7 @@ export class WasmDisassembler {
for (const exportName of this._exportMetadata.getFunctionExportNames(
funcIndex
)) {
this.appendBuffer(` (export "${exportName}")`);
this.appendBuffer(` (export ${JSON.stringify(exportName)})`);
}
}
this.appendBuffer(` (import `);
Expand All @@ -1343,7 +1343,7 @@ export class WasmDisassembler {
for (const exportName of this._exportMetadata.getGlobalExportNames(
globalIndex
)) {
this.appendBuffer(` (export "${exportName}")`);
this.appendBuffer(` (export ${JSON.stringify(exportName)})`);
}
}
this.appendBuffer(` (import `);
Expand All @@ -1364,7 +1364,7 @@ export class WasmDisassembler {
for (const exportName of this._exportMetadata.getMemoryExportNames(
memoryIndex
)) {
this.appendBuffer(` (export "${exportName}")`);
this.appendBuffer(` (export ${JSON.stringify(exportName)})`);
}
}
this.appendBuffer(` (import `);
Expand All @@ -1387,7 +1387,7 @@ export class WasmDisassembler {
for (const exportName of this._exportMetadata.getTableExportNames(
tableIndex
)) {
this.appendBuffer(` (export "${exportName}")`);
this.appendBuffer(` (export ${JSON.stringify(exportName)})`);
}
}
this.appendBuffer(` (import `);
Expand All @@ -1410,7 +1410,7 @@ export class WasmDisassembler {
for (const exportName of this._exportMetadata.getEventExportNames(
eventIndex
)) {
this.appendBuffer(` (export "${exportName}")`);
this.appendBuffer(` (export ${JSON.stringify(exportName)})`);
}
}
this.appendBuffer(` (import `);
Expand Down Expand Up @@ -1468,7 +1468,7 @@ export class WasmDisassembler {
for (const exportName of this._exportMetadata.getGlobalExportNames(
globalIndex
)) {
this.appendBuffer(` (export "${exportName}")`);
this.appendBuffer(` (export ${JSON.stringify(exportName)})`);
}
}
this.appendBuffer(` ${this.globalTypeToString(globalInfo.type)}`);
Expand Down Expand Up @@ -1575,7 +1575,7 @@ export class WasmDisassembler {
for (const exportName of this._exportMetadata.getFunctionExportNames(
this._funcIndex
)) {
this.appendBuffer(` (export "${exportName}")`);
this.appendBuffer(` (export ${JSON.stringify(exportName)})`);
}
}
for (var i = 0; i < type.params.length; i++) {
Expand Down

0 comments on commit 1c0d874

Please sign in to comment.