Skip to content

fix(engine): keep pending return value in a dedicated slot across finally - #5514

Open
xcb3d wants to merge 1 commit into
boa-dev:mainfrom
xcb3d:fix/return-finally-pending-return-slot
Open

fix(engine): keep pending return value in a dedicated slot across finally#5514
xcb3d wants to merge 1 commit into
boa-dev:mainfrom
xcb3d:fix/return-finally-pending-return-slot

Conversation

@xcb3d

@xcb3d xcb3d commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Related test262 case: test/staging/sm/Function/return-finally.js (nested try-finally where break discards an inner return).

It changes the following:

  • Keep an explicit return value that passes through a finally block in a dedicated function-level register instead of the value stack, so abrupt completions inside finally cannot leave a stale value behind for an outer pending return.
  • Save/restore the pending-return slot across finally blocks.
  • Add a regression test for a nested return discarded by break, plus the return-in-finally override case.

Verification:

  • test262 test/staging/sm/Function/return-finally.js passes (also fixes the same-named generators case with the same root cause).
  • cargo test -p boa_engine --lib passes; cargo clippy and cargo fmt check pass.

@xcb3d
xcb3d requested a review from a team as a code owner September 7, 2026 22:24
@github-actions github-actions Bot added the Waiting On Review Waiting on reviews from the maintainers label Sep 7, 2026
@github-actions github-actions Bot added this to the v0.23 milestone Sep 7, 2026
@github-actions github-actions Bot added C-Tests Issues and PRs related to the tests. C-VM Issues and PRs related to the Boa Virtual Machine. labels Sep 7, 2026
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

Test262 conformance changes

Test result main count PR count difference
Total 53,578 53,578 0
Passed 51,432 51,434 +2
Ignored 1,648 1,648 0
Failed 498 496 -2
Panics 0 0 0
Conformance 95.99% 96.00% +0.00%
Fixed tests (2):
test/staging/sm/Function/return-finally.js (previously Failed)
test/staging/sm/generators/return-finally.js (previously Failed)

Tested main commit: 257bc301afa0cda88f470a8452251ade54d516e3
Tested PR commit: ae8beeda387c38ce0998e711e82c9a5a801f353e
Compare commits: 257bc30...ae8beed

@codecov

codecov Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.83673% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.93%. Comparing base (6ddc2b4) to head (ae8beed).
⚠️ Report is 1052 commits behind head on main.

Files with missing lines Patch % Lines
core/engine/src/bytecompiler/statement/mod.rs 81.81% 4 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #5514       +/-   ##
===========================================
+ Coverage   47.24%   62.93%   +15.68%     
===========================================
  Files         476      536       +60     
  Lines       46892    60320    +13428     
===========================================
+ Hits        22154    37960    +15806     
+ Misses      24738    22360     -2378     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-Tests Issues and PRs related to the tests. C-VM Issues and PRs related to the Boa Virtual Machine. Waiting On Review Waiting on reviews from the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant