summaryrefslogtreecommitdiff
path: root/src/parser
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser')
-rw-r--r--src/parser/contexts.h11
-rw-r--r--src/parser/parsers.h11
-rw-r--r--src/parser/wast-parser.cpp7
3 files changed, 22 insertions, 7 deletions
diff --git a/src/parser/contexts.h b/src/parser/contexts.h
index f58275d71..96a70663d 100644
--- a/src/parser/contexts.h
+++ b/src/parser/contexts.h
@@ -695,7 +695,10 @@ struct NullInstrParserCtx {
Result<> makeCallRef(Index, const std::vector<Annotation>&, HeapTypeT, bool) {
return Ok{};
}
- Result<> makeRefI31(Index, const std::vector<Annotation>&) { return Ok{}; }
+ Result<>
+ makeRefI31(Index, const std::vector<Annotation>&, Shareability share) {
+ return Ok{};
+ }
Result<> makeI31Get(Index, const std::vector<Annotation>&, bool) {
return Ok{};
}
@@ -2363,8 +2366,10 @@ struct ParseDefsCtx : TypeParserCtx<ParseDefsCtx> {
return withLoc(pos, irBuilder.makeCallRef(type, isReturn));
}
- Result<> makeRefI31(Index pos, const std::vector<Annotation>& annotations) {
- return withLoc(pos, irBuilder.makeRefI31());
+ Result<> makeRefI31(Index pos,
+ const std::vector<Annotation>& annotations,
+ Shareability share) {
+ return withLoc(pos, irBuilder.makeRefI31(share));
}
Result<> makeI31Get(Index pos,
diff --git a/src/parser/parsers.h b/src/parser/parsers.h
index db450e3c6..2c3916fa3 100644
--- a/src/parser/parsers.h
+++ b/src/parser/parsers.h
@@ -221,7 +221,8 @@ template<typename Ctx>
Result<>
makeCallRef(Ctx&, Index, const std::vector<Annotation>&, bool isReturn);
template<typename Ctx>
-Result<> makeRefI31(Ctx&, Index, const std::vector<Annotation>&);
+Result<>
+makeRefI31(Ctx&, Index, const std::vector<Annotation>&, Shareability share);
template<typename Ctx>
Result<> makeI31Get(Ctx&, Index, const std::vector<Annotation>&, bool signed_);
template<typename Ctx>
@@ -2127,9 +2128,11 @@ Result<> makeCallRef(Ctx& ctx,
}
template<typename Ctx>
-Result<>
-makeRefI31(Ctx& ctx, Index pos, const std::vector<Annotation>& annotations) {
- return ctx.makeRefI31(pos, annotations);
+Result<> makeRefI31(Ctx& ctx,
+ Index pos,
+ const std::vector<Annotation>& annotations,
+ Shareability share) {
+ return ctx.makeRefI31(pos, annotations, share);
}
template<typename Ctx>
diff --git a/src/parser/wast-parser.cpp b/src/parser/wast-parser.cpp
index 137ef0df1..a3a6c14ce 100644
--- a/src/parser/wast-parser.cpp
+++ b/src/parser/wast-parser.cpp
@@ -207,6 +207,13 @@ Result<ExpectedResult> result(Lexer& in) {
return RefResult{HeapType::func};
}
+ if (in.takeSExprStart("ref.i31_shared")) {
+ if (!in.takeRParen()) {
+ return in.err("expected end of ref.i31_shared");
+ }
+ return RefResult{HeapTypes::i31.getBasic(Shared)};
+ }
+
return in.err("unrecognized result");
}