From bf665976b1526ca7cf11bacf5745563dfe193206 Mon Sep 17 00:00:00 2001 From: Thomas Lively <7121787+tlively@users.noreply.github.com> Date: Thu, 14 Oct 2021 14:11:59 -0700 Subject: 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. --- src/wasm/wasm-binary.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/wasm/wasm-binary.cpp') 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) { -- cgit v1.2.3