summaryrefslogtreecommitdiff
path: root/src/binary-reader-ir.cc
diff options
context:
space:
mode:
authorAndy Wingo <wingo@igalia.com>2019-07-25 22:03:40 +0100
committerBen Smith <binji@chromium.org>2019-07-25 14:03:40 -0700
commit34a77dcbe7c40aa2feb20d02b5bed9587f8ee2a8 (patch)
tree1a0bdfab240973656f2ff8bcb14ccc690cb5d91e /src/binary-reader-ir.cc
parent39970f8270fe869c1aec144d468811c71a5cc39c (diff)
downloadwabt-34a77dcbe7c40aa2feb20d02b5bed9587f8ee2a8.tar.gz
wabt-34a77dcbe7c40aa2feb20d02b5bed9587f8ee2a8.tar.bz2
wabt-34a77dcbe7c40aa2feb20d02b5bed9587f8ee2a8.zip
Add support for ref.null in global initializers (#1131)
As per the reference-types spec, ref.null is a constant expression. I did try to add support for ref.func at the same time, but I didn't really understand the strategy of wabt and reference types; there seems to be strong intertwingliness between func.ref and the element section, whereas it does seem possible for a func.ref to be global. Oh well, I didn't need it :)
Diffstat (limited to 'src/binary-reader-ir.cc')
-rw-r--r--src/binary-reader-ir.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/binary-reader-ir.cc b/src/binary-reader-ir.cc
index fb7b53ae..0515f660 100644
--- a/src/binary-reader-ir.cc
+++ b/src/binary-reader-ir.cc
@@ -240,6 +240,7 @@ class BinaryReaderIR : public BinaryReaderNop {
Result OnInitExprGlobalGetExpr(Index index, Index global_index) override;
Result OnInitExprI32ConstExpr(Index index, uint32_t value) override;
Result OnInitExprI64ConstExpr(Index index, uint64_t value) override;
+ Result OnInitExprRefNull(Index index) override;
private:
Location GetLocation() const;
@@ -1178,6 +1179,12 @@ Result BinaryReaderIR::OnInitExprI64ConstExpr(Index index, uint64_t value) {
return Result::Ok;
}
+Result BinaryReaderIR::OnInitExprRefNull(Index index) {
+ Location loc = GetLocation();
+ current_init_expr_->push_back(MakeUnique<RefNullExpr>(loc));
+ return Result::Ok;
+}
+
Result BinaryReaderIR::OnLocalName(Index func_index,
Index local_index,
string_view name) {