summaryrefslogtreecommitdiff
path: root/src/parser/parsers.h
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2024-04-10 15:42:03 -0700
committerGitHub <noreply@github.com>2024-04-10 22:42:03 +0000
commitdd6bcf5aab473ab8daff6029706d9350894e79a0 (patch)
treedbebc42efb80bee776827240e900bfc87656675d /src/parser/parsers.h
parent0481320ba921b25f631e4708534055ce3d67cc1c (diff)
downloadbinaryen-dd6bcf5aab473ab8daff6029706d9350894e79a0.tar.gz
binaryen-dd6bcf5aab473ab8daff6029706d9350894e79a0.tar.bz2
binaryen-dd6bcf5aab473ab8daff6029706d9350894e79a0.zip
[Parser] Parse contref and nullcontref types (#6485)
Diffstat (limited to 'src/parser/parsers.h')
-rw-r--r--src/parser/parsers.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/parser/parsers.h b/src/parser/parsers.h
index 51b5d8f9e..bcae62e14 100644
--- a/src/parser/parsers.h
+++ b/src/parser/parsers.h
@@ -425,6 +425,9 @@ template<typename Ctx> Result<typename Ctx::HeapTypeT> heaptype(Ctx& ctx) {
if (ctx.in.takeKeyword("stringview_iter"sv)) {
return ctx.makeStringViewIterType();
}
+ if (ctx.in.takeKeyword("cont"sv)) {
+ return ctx.makeContType();
+ }
if (ctx.in.takeKeyword("none"sv)) {
return ctx.makeNoneType();
}
@@ -437,6 +440,9 @@ template<typename Ctx> Result<typename Ctx::HeapTypeT> heaptype(Ctx& ctx) {
if (ctx.in.takeKeyword("noexn"sv)) {
return ctx.makeNoexnType();
}
+ if (ctx.in.takeKeyword("nocont"sv)) {
+ return ctx.makeNocontType();
+ }
auto type = typeidx(ctx);
CHECK_ERR(type);
return *type;
@@ -487,6 +493,9 @@ template<typename Ctx> MaybeResult<typename Ctx::TypeT> reftype(Ctx& ctx) {
if (ctx.in.takeKeyword("stringview_iter"sv)) {
return ctx.makeRefType(ctx.makeStringViewIterType(), Nullable);
}
+ if (ctx.in.takeKeyword("contref"sv)) {
+ return ctx.makeRefType(ctx.makeContType(), Nullable);
+ }
if (ctx.in.takeKeyword("nullref"sv)) {
return ctx.makeRefType(ctx.makeNoneType(), Nullable);
}
@@ -499,6 +508,9 @@ template<typename Ctx> MaybeResult<typename Ctx::TypeT> reftype(Ctx& ctx) {
if (ctx.in.takeKeyword("nullexnref"sv)) {
return ctx.makeRefType(ctx.makeNoexnType(), Nullable);
}
+ if (ctx.in.takeKeyword("nullcontref"sv)) {
+ return ctx.makeRefType(ctx.makeNocontType(), Nullable);
+ }
if (!ctx.in.takeSExprStart("ref"sv)) {
return {};