Unary postfix fixes

This commit is contained in:
dcodeIO
2017-12-03 01:18:35 +01:00
parent eaf9253b96
commit 032ae379cd
7 changed files with 310 additions and 15 deletions

View File

@ -0,0 +1,19 @@
var binaryen = require("binaryen");
// "non-final block elements returning a value must be drop()ed"
// "0 == 0: block with value must not have last element that is none, on"
var mod = new binaryen.Module();
var funcType = mod.addFunctionType("i", binaryen.i32, []);
var func = mod.addFunction("test", funcType, [ binaryen.i32 ],
mod.block("", [
mod.teeLocal(0, mod.i32.const(1)),
mod.nop()
], binaryen.i32)
);
mod.addExport("test", func);
console.log(mod.emitText());
if (!mod.validate())
console.log("-> does not validate");