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

Invalid sequence expression simplification #4110

Merged

Conversation

lukastaegert
Copy link
Member

@lukastaegert lukastaegert commented May 28, 2021

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 #4088
Resolves #4105
Resolves #4109

Description

This refines the rendering of simplified sequence expressions in two respects:

  • If the new leading element would require parentheses, this will now be fixed
  • If the single remaining element is a tagged template expression with a member expression as tag, it will be wrapped in a new sequence (0, <tag>) to ensure the correct this value is used. The latter also applies to other simplifications.

@github-actions
Copy link

github-actions bot commented May 28, 2021

Thank you for your contribution! ❤️

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

npm install rollup/rollup#gh-4105-invalid-sequence-expression-simplification

or load it into the REPL:
https://rollupjs.org/repl/?pr=4110

@codecov
Copy link

codecov bot commented May 28, 2021

Codecov Report

Merging #4110 (e6bf7f5) into master (700b2e0) will increase coverage by 0.07%.
The diff coverage is 95.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4110      +/-   ##
==========================================
+ Coverage   98.01%   98.08%   +0.07%     
==========================================
  Files         201      201              
  Lines        7040     7039       -1     
  Branches     2065     2061       -4     
==========================================
+ Hits         6900     6904       +4     
+ Misses         66       64       -2     
+ Partials       74       71       -3     
Impacted Files Coverage Δ
src/ast/nodes/SequenceExpression.ts 97.29% <88.88%> (+8.10%) ⬆️
src/ast/nodes/CallExpression.ts 100.00% <100.00%> (ø)
src/ast/nodes/ConditionalExpression.ts 100.00% <100.00%> (ø)
src/ast/nodes/LogicalExpression.ts 100.00% <100.00%> (ø)
src/ast/nodes/MemberExpression.ts 100.00% <100.00%> (ø)
src/ast/nodes/TaggedTemplateExpression.ts 100.00% <100.00%> (+18.18%) ⬆️

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 700b2e0...e6bf7f5. Read the comment docs.

@lukastaegert lukastaegert merged commit ecb5b16 into master May 28, 2021
@lukastaegert lukastaegert deleted the gh-4105-invalid-sequence-expression-simplification branch May 28, 2021 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant