summaryrefslogtreecommitdiff
path: root/test/heap-types.wast
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2021-01-27 17:46:31 +0000
committerGitHub <noreply@github.com>2021-01-27 09:46:31 -0800
commit2bdc4841b680ee44e132bbb07f5167eaa7226f99 (patch)
tree170585bbb9c74022201efeeee91962fdb5f0a1f1 /test/heap-types.wast
parentf82e94363a231bf570fbe3d7dc49259c8668206f (diff)
downloadbinaryen-2bdc4841b680ee44e132bbb07f5167eaa7226f99.tar.gz
binaryen-2bdc4841b680ee44e132bbb07f5167eaa7226f99.tar.bz2
binaryen-2bdc4841b680ee44e132bbb07f5167eaa7226f99.zip
[GC] ref.as_* (#3520)
These are similar to is, but instead of returning an i32 answer, they trap on an invalid value, and return it otherwise. These could in theory be in a single RefDoThing, with opcodes for both As and Is, but as the return values are different, that would be a little odd, and the name would be less clear.
Diffstat (limited to 'test/heap-types.wast')
-rw-r--r--test/heap-types.wast5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/heap-types.wast b/test/heap-types.wast
index 614bbb1c5..a36f12daf 100644
--- a/test/heap-types.wast
+++ b/test/heap-types.wast
@@ -187,4 +187,9 @@
(if (ref.is_data (local.get $x)) (unreachable))
(if (ref.is_i31 (local.get $x)) (unreachable))
)
+ (func $ref.as_X (param $x anyref)
+ (drop (ref.as_func (local.get $x)))
+ (drop (ref.as_data (local.get $x)))
+ (drop (ref.as_i31 (local.get $x)))
+ )
)