summaryrefslogtreecommitdiff
path: root/src/binary-reader-ir.cc
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2021-11-05 18:01:55 -0700
committerGitHub <noreply@github.com>2021-11-05 18:01:55 -0700
commit626008bbd59371c28c16a8b71c4469e288cd5c91 (patch)
treec3f5ab9c2500eacc686d66633725f2f714b898c0 /src/binary-reader-ir.cc
parenta49ed9a40c62c47eeb3e9b0a79b2b93afa17101f (diff)
downloadwabt-626008bbd59371c28c16a8b71c4469e288cd5c91.tar.gz
wabt-626008bbd59371c28c16a8b71c4469e288cd5c91.tar.bz2
wabt-626008bbd59371c28c16a8b71c4469e288cd5c91.zip
Remove separate OnEndFunc vs OnEndExpr. (#1756)
We already have EndFunctionBody, and this extra distinction doesn't seem like it is needed.
Diffstat (limited to 'src/binary-reader-ir.cc')
-rw-r--r--src/binary-reader-ir.cc49
1 files changed, 25 insertions, 24 deletions
diff --git a/src/binary-reader-ir.cc b/src/binary-reader-ir.cc
index 7563f7e5..121e2811 100644
--- a/src/binary-reader-ir.cc
+++ b/src/binary-reader-ir.cc
@@ -801,29 +801,31 @@ Result BinaryReaderIR::OnElseExpr() {
}
Result BinaryReaderIR::OnEndExpr() {
- LabelNode* label;
- Expr* expr;
- CHECK_RESULT(TopLabelExpr(&label, &expr));
- switch (label->label_type) {
- case LabelType::Block:
- cast<BlockExpr>(expr)->block.end_loc = GetLocation();
- break;
- case LabelType::Loop:
- cast<LoopExpr>(expr)->block.end_loc = GetLocation();
- break;
- case LabelType::If:
- cast<IfExpr>(expr)->true_.end_loc = GetLocation();
- break;
- case LabelType::Else:
- cast<IfExpr>(expr)->false_end_loc = GetLocation();
- break;
- case LabelType::Try:
- cast<TryExpr>(expr)->block.end_loc = GetLocation();
- break;
-
- case LabelType::Func:
- case LabelType::Catch:
- break;
+ if (label_stack_.size() > 1) {
+ LabelNode* label;
+ Expr* expr;
+ CHECK_RESULT(TopLabelExpr(&label, &expr));
+ switch (label->label_type) {
+ case LabelType::Block:
+ cast<BlockExpr>(expr)->block.end_loc = GetLocation();
+ break;
+ case LabelType::Loop:
+ cast<LoopExpr>(expr)->block.end_loc = GetLocation();
+ break;
+ case LabelType::If:
+ cast<IfExpr>(expr)->true_.end_loc = GetLocation();
+ break;
+ case LabelType::Else:
+ cast<IfExpr>(expr)->false_end_loc = GetLocation();
+ break;
+ case LabelType::Try:
+ cast<TryExpr>(expr)->block.end_loc = GetLocation();
+ break;
+
+ case LabelType::Func:
+ case LabelType::Catch:
+ break;
+ }
}
return PopLabel();
@@ -1078,7 +1080,6 @@ Result BinaryReaderIR::OnUnreachableExpr() {
}
Result BinaryReaderIR::EndFunctionBody(Index index) {
- CHECK_RESULT(PopLabel());
current_func_ = nullptr;
return Result::Ok;
}