mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-12 22:41:27 +00:00
Unary postfix fixes
This commit is contained in:
19
tests/binaryen/block-stack.js
Normal file
19
tests/binaryen/block-stack.js
Normal 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");
|
16
tests/binaryen/set_global-immutable.js
Normal file
16
tests/binaryen/set_global-immutable.js
Normal file
@ -0,0 +1,16 @@
|
||||
var binaryen = require("binaryen");
|
||||
|
||||
// "It is a validation error for a set_global to index an immutable global variable."
|
||||
|
||||
var mod = new binaryen.Module();
|
||||
mod.addGlobal("a", binaryen.i32, false, mod.i32.const(0));
|
||||
|
||||
var funcType = mod.addFunctionType("v", binaryen.none, []);
|
||||
var func = mod.addFunction("start", funcType, [], mod.block("", [
|
||||
mod.setGlobal("a", mod.i32.const(1))
|
||||
]));
|
||||
mod.setStart(func);
|
||||
|
||||
console.log(mod.emitText());
|
||||
if (mod.validate())
|
||||
console.log("-> validates");
|
Reference in New Issue
Block a user