diff options
author | Thomas Lively <tlively@google.com> | 2023-09-18 10:45:36 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-18 10:45:36 -0700 |
commit | cd94f8af963ea8233fc15db35ff8d9e70aff22cf (patch) | |
tree | 044d2a677ab589e49fd56420b1cc570a3cc32418 /src/wasm | |
parent | 16a59938563c93d8459bf36679c83497aeba7cc7 (diff) | |
download | binaryen-cd94f8af963ea8233fc15db35ff8d9e70aff22cf.tar.gz binaryen-cd94f8af963ea8233fc15db35ff8d9e70aff22cf.tar.bz2 binaryen-cd94f8af963ea8233fc15db35ff8d9e70aff22cf.zip |
Remove legacy type defintion text syntax (#5948)
Remove support for the "struct_subtype", "array_subtype", "func_subtype", and
"extends" notations we used at various times to declare WasmGC types, leaving
only support for the standard text fromat for declaring types. Update all the
tests using the old formats and delete tests that existed solely to test the old
formats.
Diffstat (limited to 'src/wasm')
-rw-r--r-- | src/wasm/wasm-s-parser.cpp | 44 |
1 files changed, 4 insertions, 40 deletions
diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp index 40bd6288d..7da6ae0a5 100644 --- a/src/wasm/wasm-s-parser.cpp +++ b/src/wasm/wasm-s-parser.cpp @@ -49,11 +49,9 @@ int unhex(char c) { namespace wasm { -static Name STRUCT("struct"), FIELD("field"), ARRAY("array"), - FUNC_SUBTYPE("func_subtype"), STRUCT_SUBTYPE("struct_subtype"), - ARRAY_SUBTYPE("array_subtype"), EXTENDS("extends"), REC("rec"), I8("i8"), - I16("i16"), DECLARE("declare"), ITEM("item"), OFFSET("offset"), SUB("sub"), - FINAL("final"); +static Name STRUCT("struct"), FIELD("field"), ARRAY("array"), REC("rec"), + I8("i8"), I16("i16"), DECLARE("declare"), ITEM("item"), OFFSET("offset"), + SUB("sub"), FINAL("final"); static Address getAddress(const Element* s) { return std::stoll(s->toString()); @@ -959,51 +957,17 @@ void SExpressionWasmBuilder::preParseHeapTypes(Element& module) { } else { if (kind == FUNC) { builder[index] = parseSignatureDef(def, 0); - } else if (kind == FUNC_SUBTYPE) { - builder[index].setOpen(); - builder[index] = parseSignatureDef(def, 1); - super = def[def.size() - 1]; - if (!super->dollared() && super->str() == FUNC) { - // OK; no supertype - super = nullptr; - } } else if (kind == STRUCT) { builder[index] = parseStructDef(def, index, 0); - } else if (kind == STRUCT_SUBTYPE) { - builder[index].setOpen(); - builder[index] = parseStructDef(def, index, 1); - super = def[def.size() - 1]; - if (!super->dollared() && super->str() == DATA) { - // OK; no supertype - super = nullptr; - } } else if (kind == ARRAY) { builder[index] = parseArrayDef(def); - } else if (kind == ARRAY_SUBTYPE) { - builder[index].setOpen(); - builder[index] = parseArrayDef(def); - super = def[def.size() - 1]; - if (!super->dollared() && super->str() == DATA) { - // OK; no supertype - super = nullptr; - } } else { throw ParseException("unknown heaptype kind", kind.line, kind.col); } } if (super) { - if (!super->dollared()) { - throw ParseException("unknown supertype", super->line, super->col); - } - } else if (elementStartsWith(elem[elem.size() - 1], EXTENDS)) { - // '(' 'extends' $supertype ')' - builder[index].setOpen(); - Element& extends = *elem[elem.size() - 1]; - super = extends[1]; - } - if (super) { auto it = typeIndices.find(super->toString()); - if (it == typeIndices.end()) { + if (!super->dollared() || it == typeIndices.end()) { throw ParseException("unknown supertype", super->line, super->col); } builder[index].subTypeOf(builder[it->second]); |