summaryrefslogtreecommitdiff
path: root/src/wast-parser.cc
diff options
context:
space:
mode:
authorBen Smith <binjimin@gmail.com>2019-02-13 16:27:24 -0800
committerGitHub <noreply@github.com>2019-02-13 16:27:24 -0800
commit19191efaf1b5b92b0357b303be1b25cf439be9a2 (patch)
tree1bd4be08904c059f809a69fff660de3a3cc5321c /src/wast-parser.cc
parente448ac7cbd74f7a048b1de15ce1a2716340a57c8 (diff)
downloadwabt-19191efaf1b5b92b0357b303be1b25cf439be9a2.tar.gz
wabt-19191efaf1b5b92b0357b303be1b25cf439be9a2.tar.bz2
wabt-19191efaf1b5b92b0357b303be1b25cf439be9a2.zip
Add br_on_exn instruction (#1016)
It takes two u32 immediates: the branch depth and an exception index. The stack signature is `[expect_ref] -> [except_ref]`, so the `except_ref` can be tested easily against multiple exception types.
Diffstat (limited to 'src/wast-parser.cc')
-rw-r--r--src/wast-parser.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/wast-parser.cc b/src/wast-parser.cc
index 64071faf..66e83a8c 100644
--- a/src/wast-parser.cc
+++ b/src/wast-parser.cc
@@ -111,6 +111,7 @@ bool IsPlainInstr(TokenType token_type) {
case TokenType::Select:
case TokenType::Br:
case TokenType::BrIf:
+ case TokenType::BrOnExn:
case TokenType::BrTable:
case TokenType::Return:
case TokenType::ReturnCall:
@@ -1368,6 +1369,15 @@ Result WastParser::ParsePlainInstr(std::unique_ptr<Expr>* out_expr) {
CHECK_RESULT(ParsePlainInstrVar<BrIfExpr>(loc, out_expr));
break;
+ case TokenType::BrOnExn: {
+ Consume();
+ auto expr = MakeUnique<BrOnExnExpr>(loc);
+ CHECK_RESULT(ParseVar(&expr->label_var));
+ CHECK_RESULT(ParseVar(&expr->event_var));
+ *out_expr = std::move(expr);
+ break;
+ }
+
case TokenType::BrTable: {
Consume();
auto expr = MakeUnique<BrTableExpr>(loc);