summaryrefslogtreecommitdiff
path: root/test/binaryen.js/expressions.js
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2021-01-26 21:09:31 +0000
committerGitHub <noreply@github.com>2021-01-26 13:09:31 -0800
commit5e57a13614c56f959faab675d6bcabbd629ec562 (patch)
tree3c86a2741cffa6da009741506eed4513acc60bf1 /test/binaryen.js/expressions.js
parent89164cdf1403a21a3d79ada0f0cf529d526c9de6 (diff)
downloadbinaryen-5e57a13614c56f959faab675d6bcabbd629ec562.tar.gz
binaryen-5e57a13614c56f959faab675d6bcabbd629ec562.tar.bz2
binaryen-5e57a13614c56f959faab675d6bcabbd629ec562.zip
[GC] RefIsNull => RefIs. (#3516)
This internal refactoring prepares us for ref.is_func/data/i31, by renaming the node and adding an "op" field. For now that field must always be "Null" which means it is a ref.is_null. This adjusts the C API to match the new IR shape. The high-level JS API is unchanged.
Diffstat (limited to 'test/binaryen.js/expressions.js')
-rw-r--r--test/binaryen.js/expressions.js32
1 files changed, 16 insertions, 16 deletions
diff --git a/test/binaryen.js/expressions.js b/test/binaryen.js/expressions.js
index a49546b91..6d4fa8011 100644
--- a/test/binaryen.js/expressions.js
+++ b/test/binaryen.js/expressions.js
@@ -1353,26 +1353,26 @@ console.log("# MemoryFill");
module.dispose();
})();
-console.log("# RefIsNull");
-(function testRefIsNull() {
+console.log("# RefIs");
+(function testRefIs() {
const module = new binaryen.Module();
var value = module.local.get(1, binaryen.externref);
- const theRefIsNull = binaryen.RefIsNull(module.ref.is_null(value));
- assert(theRefIsNull instanceof binaryen.RefIsNull);
- assert(theRefIsNull instanceof binaryen.Expression);
- assert(theRefIsNull.value === value);
- assert(theRefIsNull.type === binaryen.i32);
-
- theRefIsNull.value = value = module.local.get(2, binaryen.externref);
- assert(theRefIsNull.value === value);
- theRefIsNull.type = binaryen.f64;
- theRefIsNull.finalize();
- assert(theRefIsNull.type === binaryen.i32);
-
- console.log(theRefIsNull.toText());
+ const theRefIs = binaryen.RefIs(module.ref.is_null(value));
+ assert(theRefIs instanceof binaryen.RefIs);
+ assert(theRefIs instanceof binaryen.Expression);
+ assert(theRefIs.value === value);
+ assert(theRefIs.type === binaryen.i32);
+
+ theRefIs.value = value = module.local.get(2, binaryen.externref);
+ assert(theRefIs.value === value);
+ theRefIs.type = binaryen.f64;
+ theRefIs.finalize();
+ assert(theRefIs.type === binaryen.i32);
+
+ console.log(theRefIs.toText());
assert(
- theRefIsNull.toText()
+ theRefIs.toText()
==
"(ref.is_null\n (local.get $2)\n)\n"
);