summaryrefslogtreecommitdiff
path: root/src/shared-validator.cc
diff options
context:
space:
mode:
authorBen Smith <binji@chromium.org>2020-05-28 11:30:38 -0700
committerGitHub <noreply@github.com>2020-05-28 11:30:38 -0700
commitbf46c08b05fc6fcc457f1657e936fab24b4dceee (patch)
treef57a19c670a3e222896c252c829d5eb5ec4db6d2 /src/shared-validator.cc
parent0630dc53755678239d7609b61776b125221eefb8 (diff)
downloadwabt-bf46c08b05fc6fcc457f1657e936fab24b4dceee.tar.gz
wabt-bf46c08b05fc6fcc457f1657e936fab24b4dceee.tar.bz2
wabt-bf46c08b05fc6fcc457f1657e936fab24b4dceee.zip
Reference types changes to remove subtyping (#1407)
Main changes: * Rename `anyref` -> `externref` * Remove `nullref` * Rename `hostref` -> `externref` * `ref.null` and `ref.is_null` now have "ref kind" parameter * Add ref kind keywords: `func`, `extern`, `exn`
Diffstat (limited to 'src/shared-validator.cc')
-rw-r--r--src/shared-validator.cc22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/shared-validator.cc b/src/shared-validator.cc
index e84ccf12..f4a7303e 100644
--- a/src/shared-validator.cc
+++ b/src/shared-validator.cc
@@ -119,7 +119,7 @@ Result SharedValidator::OnTable(const Location& loc,
if (limits.is_shared) {
result |= PrintError(loc, "tables may not be shared");
}
- if (elem_type != Type::Funcref &&
+ if (elem_type != Type::FuncRef &&
!options_.features.reference_types_enabled()) {
result |= PrintError(loc, "tables must have funcref type");
}
@@ -209,8 +209,9 @@ Result SharedValidator::OnGlobalInitExpr_GlobalGet(const Location& loc,
return result;
}
-Result SharedValidator::OnGlobalInitExpr_RefNull(const Location& loc) {
- return CheckType(loc, Type::Nullref, globals_.back().type,
+Result SharedValidator::OnGlobalInitExpr_RefNull(const Location& loc,
+ Type type) {
+ return CheckType(loc, type, globals_.back().type,
"global initializer expression");
}
@@ -219,7 +220,7 @@ Result SharedValidator::OnGlobalInitExpr_RefFunc(const Location& loc,
Result result = Result::Ok;
result |= CheckFuncIndex(func_var);
init_expr_funcs_.push_back(func_var);
- result |= CheckType(loc, Type::Funcref, globals_.back().type,
+ result |= CheckType(loc, Type::FuncRef, globals_.back().type,
"global initializer expression");
return result;
}
@@ -335,8 +336,9 @@ Result SharedValidator::OnElemSegmentInitExpr_Other(const Location& loc) {
"global.get.");
}
-Result SharedValidator::OnElemSegmentElemExpr_RefNull(const Location& loc) {
- return Result::Ok;
+Result SharedValidator::OnElemSegmentElemExpr_RefNull(const Location& loc,
+ Type type) {
+ return CheckType(loc, type, elems_.back().element, "elem expression");
}
Result SharedValidator::OnElemSegmentElemExpr_RefFunc(const Location& loc,
@@ -966,17 +968,17 @@ Result SharedValidator::OnRefFunc(const Location& loc, Var func_var) {
return result;
}
-Result SharedValidator::OnRefIsNull(const Location& loc) {
+Result SharedValidator::OnRefIsNull(const Location& loc, Type type) {
Result result = Result::Ok;
expr_loc_ = &loc;
- result |= typechecker_.OnRefIsNullExpr();
+ result |= typechecker_.OnRefIsNullExpr(type);
return result;
}
-Result SharedValidator::OnRefNull(const Location& loc) {
+Result SharedValidator::OnRefNull(const Location& loc, Type type) {
Result result = Result::Ok;
expr_loc_ = &loc;
- result |= typechecker_.OnRefNullExpr();
+ result |= typechecker_.OnRefNullExpr(type);
return result;
}