diff --git a/scripts/test/shared.py b/scripts/test/shared.py index ad02b617d44..026f5c9dc5f 100644 --- a/scripts/test/shared.py +++ b/scripts/test/shared.py @@ -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 diff --git a/src/parser/parsers.h b/src/parser/parsers.h index 2a3a5ec5a4e..a58c59145fd 100644 --- a/src/parser/parsers.h +++ b/src/parser/parsers.h @@ -3704,21 +3704,17 @@ MaybeResult maybeElemexpr(Ctx& ctx) { MaybeResult 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; } @@ -3777,16 +3773,14 @@ template 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()) { @@ -3848,14 +3842,11 @@ template 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) {