Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix switch statement break and continue return values #3205

Merged
merged 2 commits into from Aug 11, 2023
Merged

Conversation

raskad
Copy link
Member

@raskad raskad commented Aug 9, 2023

This Pull Request fixes the remaining "language/statements/switch" tests with exception of the tco tests.

It changes the following:

This removes the current behaviour of setting the return value to undefined whenever there is a break or continue statement at the start of a block. This was causing the return value to be unexpectedly overwritten in switch statements.
Instead this is now only implemented for catch and finally blocks where this behaviour mirrors the UpdateEmpty statements in the spec.

@raskad raskad added bug Something isn't working execution Issues or PRs related to code execution labels Aug 9, 2023
@raskad raskad added this to the v0.18.0 milestone Aug 9, 2023
@github-actions
Copy link

github-actions bot commented Aug 9, 2023

Test262 conformance changes

Test result main count PR count difference
Total 95,282 95,282 0
Passed 75,036 75,046 +10
Ignored 19,220 19,220 0
Failed 1,026 1,016 -10
Panics 0 0 0
Conformance 78.75% 78.76% +0.01%
Fixed tests (10):
test/language/statements/switch/cptn-b-fall-thru-abrupt-empty.js [strict mode] (previously Failed)
test/language/statements/switch/cptn-b-fall-thru-abrupt-empty.js (previously Failed)
test/language/statements/switch/cptn-dflt-fall-thru-abrupt-empty.js [strict mode] (previously Failed)
test/language/statements/switch/cptn-dflt-fall-thru-abrupt-empty.js (previously Failed)
test/language/statements/switch/cptn-dflt-b-fall-thru-abrupt-empty.js [strict mode] (previously Failed)
test/language/statements/switch/cptn-dflt-b-fall-thru-abrupt-empty.js (previously Failed)
test/language/statements/switch/cptn-no-dflt-match-fall-thru-abrupt-empty.js [strict mode] (previously Failed)
test/language/statements/switch/cptn-no-dflt-match-fall-thru-abrupt-empty.js (previously Failed)
test/language/statements/switch/cptn-a-fall-thru-abrupt-empty.js [strict mode] (previously Failed)
test/language/statements/switch/cptn-a-fall-thru-abrupt-empty.js (previously Failed)

@codecov
Copy link

codecov bot commented Aug 9, 2023

Codecov Report

Merging #3205 (bb1d0dd) into main (9665f8b) will increase coverage by 0.01%.
Report is 2 commits behind head on main.
The diff coverage is 83.33%.

@@            Coverage Diff             @@
##             main    #3205      +/-   ##
==========================================
+ Coverage   50.43%   50.44%   +0.01%     
==========================================
  Files         436      436              
  Lines       42531    42544      +13     
==========================================
+ Hits        21450    21461      +11     
- Misses      21081    21083       +2     
Files Changed Coverage Δ
boa_engine/src/bytecompiler/mod.rs 66.58% <ø> (-0.35%) ⬇️
boa_engine/src/bytecompiler/statement/try.rs 91.01% <83.33%> (-1.40%) ⬇️

... and 1 file with indirect coverage changes

@raskad raskad requested a review from a team August 10, 2023 02:24
Copy link
Member

@Razican Razican left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Thanks :)

Copy link
Member

@HalidOdat HalidOdat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice change! Just some small nitpicks :)

boa_engine/src/bytecompiler/statement/try.rs Outdated Show resolved Hide resolved
boa_engine/src/bytecompiler/statement/try.rs Outdated Show resolved Hide resolved
Copy link
Member

@HalidOdat HalidOdat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks perfect to me :)

@HalidOdat HalidOdat added this pull request to the merge queue Aug 11, 2023
Merged via the queue into main with commit cd232b1 Aug 11, 2023
9 checks passed
@HalidOdat HalidOdat deleted the switch-fix branch August 11, 2023 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working execution Issues or PRs related to code execution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants