More options for asc; asm.js output

This commit is contained in:
dcodeIO
2017-12-09 00:45:12 +01:00
parent 64516eecfb
commit bbc71ebe81
5 changed files with 79 additions and 14 deletions

View File

@ -40,3 +40,12 @@ Module.prototype.toText = function toText() {
binaryen.print = previousPrint;
return ret;
}
Module.prototype.toAsmjs = function toAsmjs() {
var previousPrint = binaryen.print;
var ret = "";
binaryen.print = function print(x) { ret += x + "\n" };
this.printAsmjs();
binaryen.print = previousPrint;
return ret;
}

View File

@ -743,6 +743,10 @@ export class Module {
return _BinaryenModulePrint(this.ref);
}
printAsmjs(): void {
return _BinaryenModulePrintAsmjs(this.ref);
}
toBinary(bufferSize: usize = 1048576): Uint8Array {
// FIXME: target specific / JS glue overrides this
throw new Error("not implemented");