diff options
Diffstat (limited to 'src/wasm/wasm-binary.cpp')
-rw-r--r-- | src/wasm/wasm-binary.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index 51325e7dd..d43640e26 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -265,13 +265,11 @@ void WasmBinaryWriter::writeTypes() { // Emit the type definition. BYN_TRACE("write " << type << std::endl); auto super = type.getSuperType(); - // TODO: Use the binary shorthand for final types once we parse MVP - // signatures as final. - if (type.isFinal() || super || hasSubtypes[i]) { - if (type.isFinal()) { - o << S32LEB(BinaryConsts::EncodedType::SubFinal); - } else { + if (super || type.isOpen()) { + if (type.isOpen()) { o << S32LEB(BinaryConsts::EncodedType::Sub); + } else { + o << S32LEB(BinaryConsts::EncodedType::SubFinal); } if (super) { o << U32LEB(1); @@ -2268,9 +2266,8 @@ void WasmBinaryReader::readTypes() { std::optional<uint32_t> superIndex; if (form == BinaryConsts::EncodedType::Sub || form == BinaryConsts::EncodedType::SubFinal) { - if (form == BinaryConsts::EncodedType::SubFinal) { - // TODO: Interpret type definitions without any `sub` as final as well. - builder[i].setFinal(); + if (form == BinaryConsts::EncodedType::Sub) { + builder[i].setOpen(); } uint32_t supers = getU32LEB(); if (supers > 0) { |