Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Make array.new_fixed length annotations mandatory
They were previously optional to ease the transition to the standard text
format, but now we can make them mandatory to match the spec. This will simplify
the new text parser as well.
  • Loading branch information
tlively committed Feb 5, 2024
commit d3af20443ae04dbc26317f64f6156eacf76f07cb
16 changes: 5 additions & 11 deletions src/wasm/wasm-s-parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3161,18 +3161,12 @@ Expression* SExpressionWasmBuilder::makeArrayNewElem(Element& s) {

Expression* SExpressionWasmBuilder::makeArrayNewFixed(Element& s) {
auto heapType = parseHeapType(*s[1]);
size_t i = 2;
std::vector<Expression*> values;
if (i < s.size() && s[i]->isStr()) {
// With the standard syntax one should specify explicitly the size
// of the array
if ((size_t)parseIndex(*s[i]) != s.size() - 3) {
throw SParseException("wrong number of elements in array", s);
}
i++;
if ((size_t)parseIndex(*s[2]) != s.size() - 3) {
throw SParseException("wrong number of elements in array", s);
}
while (i < s.size()) {
values.push_back(parseExpression(*s[i++]));
std::vector<Expression*> values;
for (size_t i = 3; i < s.size(); ++i) {
values.push_back(parseExpression(*s[i]));
}
return Builder(wasm).makeArrayNewFixed(heapType, values);
}
Expand Down
36 changes: 0 additions & 36 deletions test/lit/array-new-fixed.wast

This file was deleted.