Skip to content

Commit

Permalink
[pjs] Correct handling of an empty catch clause
Browse files Browse the repository at this point in the history
  • Loading branch information
pajama-coder committed May 14, 2024
1 parent 1ad1a33 commit 7a65bb5
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/pjs/stmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,16 @@ void Block::resolve(Module *module, Context &ctx, int l, Tree::LegacyImports *im
}

void Block::execute(Context &ctx, Result &result) {
if (!m_stmts.empty()) {
for (const auto &p : m_stmts) {
p->execute(ctx, result);
if (!result.is_done()) return;
}
if (m_stmts.empty()) {
result.value = Value::undefined;
result.set_done();
return;
}
for (const auto &p : m_stmts) {
p->execute(ctx, result);
if (!result.is_done()) return;
}
result.set_done();
}

void Block::dump(std::ostream &out, const std::string &indent) {
Expand Down

0 comments on commit 7a65bb5

Please sign in to comment.