summaryrefslogtreecommitdiff
path: root/src/parser/parsers.h
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2024-01-30 06:24:39 -0800
committerGitHub <noreply@github.com>2024-01-30 06:24:39 -0800
commit9361edfcd83310b2eac6ceca08db0d44ad22aa52 (patch)
tree6b4a940eb71744221ff56b2392d81be6799a97a8 /src/parser/parsers.h
parent88d6b7c08f3fbf1b510ae630f83ff8d44321b151 (diff)
downloadbinaryen-9361edfcd83310b2eac6ceca08db0d44ad22aa52.tar.gz
binaryen-9361edfcd83310b2eac6ceca08db0d44ad22aa52.tar.bz2
binaryen-9361edfcd83310b2eac6ceca08db0d44ad22aa52.zip
[Parser] Parse pops (by doing nothing) (#6252)
Parse pop expressions and check that they have the expected types, but do not actually create new Pop expressions or push anything onto the stack because we already create Pop expressions as necessary when visiting the beginning of catch blocks. Unlike the legacy text parser, the new text parser is not capable of parsing pops in invalid locations in the IR. This means that the new text parser will never be able to parse test/lit/catch-pop-fixup-eh-old.wast, which deliberately parses invalid IR to check that the pops can be fixed up and moved to the correct locations. It should be acceptable to delete that test when we turn on the new parser by default, though, so that won't be a problem.
Diffstat (limited to 'src/parser/parsers.h')
-rw-r--r--src/parser/parsers.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/parser/parsers.h b/src/parser/parsers.h
index 706c6525e..c7b9168b1 100644
--- a/src/parser/parsers.h
+++ b/src/parser/parsers.h
@@ -1555,7 +1555,9 @@ template<typename Ctx> Result<> makeMemoryFill(Ctx& ctx, Index pos) {
}
template<typename Ctx> Result<> makePop(Ctx& ctx, Index pos) {
- return ctx.in.err("unimplemented instruction");
+ auto type = valtype(ctx);
+ CHECK_ERR(type);
+ return ctx.makePop(pos, *type);
}
template<typename Ctx> Result<> makeCall(Ctx& ctx, Index pos, bool isReturn) {