summaryrefslogtreecommitdiff
path: root/src/expr-visitor.cc
diff options
context:
space:
mode:
authorSoni L. <EnderMoneyMod@gmail.com>2024-11-20 14:51:48 -0300
committerGitHub <noreply@github.com>2024-11-20 09:51:48 -0800
commita0b7abef00b59eeafed58c774195189425d020b0 (patch)
tree6f7b0747d3a3ef435bda9ac14ca22d417877796b /src/expr-visitor.cc
parent958d0a72030227bf3133c8b99c7c670bcdbc7636 (diff)
downloadwabt-a0b7abef00b59eeafed58c774195189425d020b0.tar.gz
wabt-a0b7abef00b59eeafed58c774195189425d020b0.tar.bz2
wabt-a0b7abef00b59eeafed58c774195189425d020b0.zip
binary/wat: Implement EHv4 (#2470)
This pull request implements EHv4. Binary is mostly untested until interp is working.
Diffstat (limited to 'src/expr-visitor.cc')
-rw-r--r--src/expr-visitor.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/expr-visitor.cc b/src/expr-visitor.cc
index 05cd2798..217d45cc 100644
--- a/src/expr-visitor.cc
+++ b/src/expr-visitor.cc
@@ -90,6 +90,18 @@ Result ExprVisitor::VisitExpr(Expr* root_expr) {
break;
}
+ case State::TryTable: {
+ auto try_table_expr = cast<TryTableExpr>(expr);
+ auto& iter = expr_iter_stack_.back();
+ if (iter != try_table_expr->block.exprs.end()) {
+ PushDefault(&*iter++);
+ } else {
+ CHECK_RESULT(delegate_->EndTryTableExpr(try_table_expr));
+ PopExprlist();
+ }
+ break;
+ }
+
case State::Try: {
auto try_expr = cast<TryExpr>(expr);
auto& iter = expr_iter_stack_.back();
@@ -386,6 +398,17 @@ Result ExprVisitor::HandleDefaultState(Expr* expr) {
CHECK_RESULT(delegate_->OnThrowExpr(cast<ThrowExpr>(expr)));
break;
+ case ExprType::ThrowRef:
+ CHECK_RESULT(delegate_->OnThrowRefExpr(cast<ThrowRefExpr>(expr)));
+ break;
+
+ case ExprType::TryTable: {
+ auto try_table_expr = cast<TryTableExpr>(expr);
+ CHECK_RESULT(delegate_->BeginTryTableExpr(try_table_expr));
+ PushExprlist(State::TryTable, expr, try_table_expr->block.exprs);
+ break;
+ }
+
case ExprType::Try: {
auto try_expr = cast<TryExpr>(expr);
CHECK_RESULT(delegate_->BeginTryExpr(try_expr));