Skip to content
Draft
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
1 change: 0 additions & 1 deletion scripts/test/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,6 @@ def get_tests(test_dir, extensions=[], recursive=False):

# Paths are relative to the test/spec/testsuite directory
SPEC_TESTSUITE_TESTS_TO_SKIP = [
'array_new_elem.wast', # Failure to parse element segment item abbreviation
'binary.wast', # Missing data count section validation
'call_indirect64.wast', # Failure to parse element segment abbreviation
'comments.wast', # Issue with carriage returns being treated as newlines
Expand Down
41 changes: 16 additions & 25 deletions src/parser/parsers.h
Original file line number Diff line number Diff line change
Expand Up @@ -3704,21 +3704,17 @@ MaybeResult<typename Ctx::ExprT> maybeElemexpr(Ctx& ctx) {
MaybeResult<typename Ctx::ExprT> result;
if (ctx.in.takeSExprStart("item"sv)) {
result = expr(ctx);
} else if (ctx.in.takeLParen()) {
// TODO: `instr` should included both folded and unfolded instrs.
if (auto inst = instr(ctx)) {
CHECK_ERR(inst);
} else {
return ctx.in.err("expected instruction");
CHECK_ERR(result);
if (!ctx.in.takeRParen()) {
return ctx.in.err("expected end of element expression");
}
} else if (auto exp = foldedinstr(ctx)) {
CHECK_ERR(exp);
result = ctx.makeExpr();
CHECK_ERR(result);
} else {
return {};
}
CHECK_ERR(result);
if (!ctx.in.takeRParen()) {
return ctx.in.err("expected end of element expression");
}
return result;
}

Expand Down Expand Up @@ -3777,16 +3773,14 @@ template<typename Ctx> MaybeResult<> elem(Ctx& ctx) {
// This may be an abbreviated offset instruction or it may be the
// beginning of the elemlist.
auto beforeLParen = ctx.in.getPos();
if (ctx.in.takeLParen()) {
if (auto inst = instr(ctx)) {
CHECK_ERR(inst);
auto off = ctx.makeExpr();
CHECK_ERR(off);
offset = *off;
} else {
// This must be the beginning of the elemlist instead.
ctx.in.setPos(beforeLParen);
}
if (auto inst = foldedinstr(ctx)) {
CHECK_ERR(inst);
auto off = ctx.makeExpr();
CHECK_ERR(off);
offset = *off;
} else {
// This must be the beginning of the elemlist instead.
ctx.in.setPos(beforeLParen);
}
}
if (offset && !ctx.in.takeRParen()) {
Expand Down Expand Up @@ -3848,14 +3842,11 @@ template<typename Ctx> MaybeResult<> data(Ctx& ctx) {
return ctx.in.err("expected end of offset expression");
}
offset = *e;
} else if (ctx.in.takeLParen()) {
CHECK_ERR(instr(ctx));
} else if (auto inst = foldedinstr(ctx)) {
CHECK_ERR(inst);
auto offsetExpr = ctx.makeExpr();
CHECK_ERR(offsetExpr);
offset = *offsetExpr;
if (!ctx.in.takeRParen()) {
return ctx.in.err("expected end of offset instruction");
}
}

if (mem && !offset) {
Expand Down
Loading