summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-binary.cpp
diff options
context:
space:
mode:
authorThomas Lively <7121787+tlively@users.noreply.github.com>2021-10-14 14:11:59 -0700
committerGitHub <noreply@github.com>2021-10-14 21:11:59 +0000
commitbf665976b1526ca7cf11bacf5745563dfe193206 (patch)
treea6bb2cf0fa5d1972fe55f872418665778e00dde5 /src/wasm/wasm-binary.cpp
parentd592bad2b8fa777dab9682d2d2e47f9957c8051d (diff)
downloadbinaryen-bf665976b1526ca7cf11bacf5745563dfe193206.tar.gz
binaryen-bf665976b1526ca7cf11bacf5745563dfe193206.tar.bz2
binaryen-bf665976b1526ca7cf11bacf5745563dfe193206.zip
Switch from "extends" to M4 nominal syntax (#4248)
Switch from "extends" to M4 nominal syntax Change all test inputs from using the old (extends $super) syntax to using the new *_subtype syntax for their inputs and also update the printer to emit the new syntax. Add a new test explicitly testing the old notation to make sure it keeps working until we remove support for it.
Diffstat (limited to 'src/wasm/wasm-binary.cpp')
-rw-r--r--src/wasm/wasm-binary.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp
index 70bc738f6..e2dacdf70 100644
--- a/src/wasm/wasm-binary.cpp
+++ b/src/wasm/wasm-binary.cpp
@@ -219,11 +219,11 @@ void WasmBinaryWriter::writeTypes() {
return;
}
BYN_TRACE("== writeTypes\n");
- bool nominal = getTypeSystem() == TypeSystem::Nominal;
auto start = startSection(BinaryConsts::Section::Type);
o << U32LEB(types.size());
for (Index i = 0; i < types.size(); ++i) {
auto type = types[i];
+ bool nominal = type.isNominal() || getTypeSystem() == TypeSystem::Nominal;
BYN_TRACE("write " << type << std::endl);
if (type.isSignature()) {
o << S32LEB(nominal ? BinaryConsts::EncodedType::FuncExtending
@@ -1959,6 +1959,8 @@ void WasmBinaryBuilder::readTypes() {
if (form == BinaryConsts::EncodedType::FuncExtending ||
form == BinaryConsts::EncodedType::StructExtending ||
form == BinaryConsts::EncodedType::ArrayExtending) {
+ // TODO: Let the new nominal types coexist with equirecursive types
+ // builder[i].setNominal();
auto superIndex = getS64LEB(); // TODO: Actually s33
if (superIndex >= 0) {
if (size_t(superIndex) >= numTypes) {