summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-s-parser.cpp
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 /src/wasm/wasm-s-parser.cpp
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 'src/wasm/wasm-s-parser.cpp')
-rw-r--r--src/wasm/wasm-s-parser.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp
index b9927cbc7..5dec22eb3 100644
--- a/src/wasm/wasm-s-parser.cpp
+++ b/src/wasm/wasm-s-parser.cpp
@@ -2236,6 +2236,10 @@ Expression* SExpressionWasmBuilder::makeArrayLen(Element& s) {
return Builder(wasm).makeArrayLen(ref);
}
+Expression* SExpressionWasmBuilder::makeRefAs(Element& s, RefAsOp op) {
+ return Builder(wasm).makeRefAs(op, parseExpression(s[1]));
+}
+
// converts an s-expression string representing binary data into an output
// sequence of raw bytes this appends to data, which may already contain
// content.