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

[Merged by Bors] - Return the correct value from a statement list #2554

Closed
wants to merge 1 commit into from

Conversation

raskad
Copy link
Member

@raskad raskad commented Jan 21, 2023

When compiling a statement list we need to make sure that the last expression that returns a value is compiled with the use_expr flag. Currently we set use_expr on the last statement of the statement list. This leads to incorrect returns when the last statement does not return a value. This PR fixes this by looking up the last value returning expression in a statement list and setting the use_expr appropriately.

@raskad raskad added bug Something isn't working vm Issues and PRs related to the Boa Virtual Machine. labels Jan 21, 2023
@raskad raskad added this to the v0.17.0 milestone Jan 21, 2023
@github-actions
Copy link

Test262 conformance changes

Test result main count PR count difference
Total 94,205 94,205 0
Passed 70,624 70,632 +8
Ignored 18,622 18,622 0
Failed 4,959 4,951 -8
Panics 0 0 0
Conformance 74.97% 74.98% +0.01%
Fixed tests (8):
test/language/statements/variable/cptn-value.js [strict mode] (previously Failed)
test/language/statements/variable/cptn-value.js (previously Failed)
test/language/statements/const/cptn-value.js [strict mode] (previously Failed)
test/language/statements/const/cptn-value.js (previously Failed)
test/language/statements/class/cptn-decl.js [strict mode] (previously Failed)
test/language/statements/class/cptn-decl.js (previously Failed)
test/language/statements/let/cptn-value.js [strict mode] (previously Failed)
test/language/statements/let/cptn-value.js (previously Failed)

@codecov
Copy link

codecov bot commented Jan 21, 2023

Codecov Report

Merging #2554 (70ca9d4) into main (f19467a) will increase coverage by 0.29%.
The diff coverage is 40.00%.

@@            Coverage Diff             @@
##             main    #2554      +/-   ##
==========================================
+ Coverage   49.99%   50.28%   +0.29%     
==========================================
  Files         379      373       -6     
  Lines       37642    37423     -219     
==========================================
  Hits        18819    18819              
+ Misses      18823    18604     -219     
Impacted Files Coverage Δ
boa_engine/src/bytecompiler/mod.rs 57.72% <40.00%> (-0.39%) ⬇️
boa_engine/src/vm/mod.rs 48.75% <0.00%> (-1.00%) ⬇️
boa_gc/src/cell.rs 58.75% <0.00%> (-0.57%) ⬇️
boa_examples/src/bin/symbol_visitor.rs 0.00% <0.00%> (ø)
boa_examples/src/bin/commuter_visitor.rs 0.00% <0.00%> (ø)
boa_examples/src/bin/jsdate.rs
boa_examples/src/bin/jsregexp.rs
boa_examples/src/bin/loadfile.rs
boa_examples/src/bin/modulehandler.rs
boa_examples/src/bin/jstypedarray.rs
... and 1 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Member

@jedel1043 jedel1043 left a comment

Choose a reason for hiding this comment

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

Nice!

@jedel1043
Copy link
Member

bors r+

bors bot pushed a commit that referenced this pull request Jan 23, 2023
When compiling a statement list we need to make sure that the last expression that returns a value is compiled with the `use_expr` flag. Currently we set `use_expr` on the last statement of the statement list. This leads to incorrect returns when the last statement does not return a value. This PR fixes this by looking up the last value returning expression in a statement list  and setting the `use_expr` appropriately.
@bors
Copy link

bors bot commented Jan 23, 2023

Pull request successfully merged into main.

Build succeeded:

@bors bors bot changed the title Return the correct value from a statement list [Merged by Bors] - Return the correct value from a statement list Jan 23, 2023
@bors bors bot closed this Jan 23, 2023
@bors bors bot deleted the fix-use-expressions-statement-list branch January 23, 2023 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working vm Issues and PRs related to the Boa Virtual Machine.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants