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

Make sure logical expressions always check the left argument for side effects #3438

Merged
merged 1 commit into from Mar 12, 2020

Conversation

lukastaegert
Copy link
Member

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • no

List any relevant issue numbers:
Resolves #3382

Description

There is a bug in logical expressions in that it would only check one of the arguments for side-effects if the value can be resolved at some point. However, checking for side-effects has the "side-effect" of binding new assignments, which in the linked issue was necessary to trigger some deoptimizations. The fix here is rather small even though tracking it was quite intricate.

@rollup-bot
Copy link
Collaborator

Thank you for your contribution! ❤️

You can try out this pull request locally by installing Rollup via

npm install rollup/rollup#gh-3382-fix-logical-expression-deoptimization

or load it into the REPL:
https://rollupjs.org/repl/?circleci=9889

@codecov
Copy link

codecov bot commented Mar 12, 2020

Codecov Report

Merging #3438 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3438      +/-   ##
==========================================
+ Coverage   95.01%   95.01%   +<.01%     
==========================================
  Files         171      171              
  Lines        5838     5840       +2     
  Branches     1723     1723              
==========================================
+ Hits         5547     5549       +2     
  Misses        157      157              
  Partials      134      134
Impacted Files Coverage Δ
src/ast/nodes/LogicalExpression.ts 98.73% <100%> (+0.03%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2895a55...7883f36. Read the comment docs.

@lukastaegert lukastaegert merged commit 5a45128 into master Mar 12, 2020
@lukastaegert lukastaegert deleted the gh-3382-fix-logical-expression-deoptimization branch March 12, 2020 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Module's function gets rewritten
2 participants