Skip to content

Commit ec393a8

Browse files
committed
does you work
1 parent 3116b6a commit ec393a8

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

src/wasm-ir-builder.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -399,12 +399,8 @@ class IRBuilder : public UnifiedExpressionVisitor<IRBuilder, Result<>> {
399399
static ScopeCtx makeTry(Try* tryy, Name originalLabel, Type inputType) {
400400
return ScopeCtx(TryScope{tryy, originalLabel}, inputType);
401401
}
402-
static ScopeCtx
403-
makeCatch(Try* tryy, Name originalLabel, Index index, Name label) {
404-
return ScopeCtx(CatchScope{tryy, originalLabel, index}, label);
405-
}
406-
static ScopeCtx makeCatch(ScopeCtx&& scope, Try* tryy) {
407-
scope.scope = CatchScope{tryy, scope.getOriginalLabel()};
402+
static ScopeCtx makeCatch(ScopeCtx&& scope, Try* tryy, Index index) {
403+
scope.scope = CatchScope{tryy, scope.getOriginalLabel(), index};
408404
scope.resetForDelimiter(/*keepInput=*/false);
409405
return scope;
410406
}

src/wasm/wasm-ir-builder.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -964,7 +964,7 @@ Result<> IRBuilder::visitCatch(Name tag) {
964964
delimiterLocs[delimiterLocs.size()] = lastBinaryPos - codeSectionOffset;
965965
}
966966

967-
CHECK_ERR(pushScope(ScopeCtx::makeCatch(tryy, originalLabel, index, label)));
967+
CHECK_ERR(pushScope(ScopeCtx::makeCatch(std::move(scope), tryy, index)));
968968
// Push a pop for the exception payload if necessary.
969969
auto params = wasm.getTag(tag)->params();
970970
if (params != Type::none) {
@@ -1147,6 +1147,8 @@ Result<> IRBuilder::visitEnd() {
11471147
tryy->catchBodies.resize(index + 1);
11481148
}
11491149
tryy->catchBodies[index] = *expr;
1150+
tryy->finalize(tryy->type);
1151+
push(maybeWrapForLabel(tryy));
11501152
} else if (auto* trytable = scope.getTryTable()) {
11511153
trytable->body = *expr;
11521154
trytable->finalize(trytable->type, &wasm);

0 commit comments

Comments
 (0)