Skip to content

Commit 397ed55

Browse files
authored
fix: Remove runPass and use runPasses only (#2005)
1 parent e7e7a1d commit 397ed55

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

cli/asc.js

+11-3
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ exports.main = function main(argv, options, callback) {
529529
transforms = transforms.map(classOrModule => {
530530
// Except if it’s a legacy module, just pass it through.
531531
if (typeof classOrModule !== "function") {
532-
return classOrModule;
532+
return classOrModule;
533533
}
534534
Object.assign(classOrModule.prototype, {
535535
program,
@@ -881,12 +881,20 @@ exports.main = function main(argv, options, callback) {
881881
if (opts.trapMode === "clamp") {
882882
stats.optimizeCount++;
883883
stats.optimizeTime += measure(() => {
884-
module.runPass("trap-mode-clamp");
884+
try {
885+
module.runPasses(["trap-mode-clamp"]);
886+
} catch (e) {
887+
crash("runPasses", e);
888+
}
885889
});
886890
} else if (opts.trapMode === "js") {
887891
stats.optimizeCount++;
888892
stats.optimizeTime += measure(() => {
889-
module.runPass("trap-mode-js");
893+
try {
894+
module.runPasses(["trap-mode-js"]);
895+
} catch (e) {
896+
crash("runPasses", e);
897+
}
890898
});
891899
} else if (opts.trapMode !== "allow") {
892900
module.dispose();

src/module.ts

-10
Original file line numberDiff line numberDiff line change
@@ -2191,16 +2191,6 @@ export class Module {
21912191
binaryen._BinaryenModuleSetFeatures(this.ref, featureFlags);
21922192
}
21932193

2194-
runPass(pass: string, func: FunctionRef = 0): void {
2195-
var cStr = allocString(pass);
2196-
if (func) {
2197-
binaryen._BinaryenFunctionRunPasses(func, this.ref, cStr, 1);
2198-
} else {
2199-
binaryen._BinaryenModuleRunPasses(this.ref, cStr, 1);
2200-
}
2201-
binaryen._free(cStr);
2202-
}
2203-
22042194
runPasses(passes: string[], func: FunctionRef = 0): void {
22052195
var numNames = passes.length;
22062196
var cStrs = new Array<StringRef>(numNames);

0 commit comments

Comments
 (0)