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

Deoptimize parameter defaults when referenced from object/array/class literals #4518

Merged
merged 1 commit into from May 31, 2022

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 #4516

Description

This resolves another oversight in the original default parameter implementation. The current solution is to explicitly deoptimize when something is referenced in any kind of literal.

@github-actions
Copy link

github-actions bot commented May 31, 2022

Thank you for your contribution! ❤️

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

npm install rollup/rollup#gh-4516_deoptimize_defaults

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

@codecov
Copy link

codecov bot commented May 31, 2022

Codecov Report

Merging #4518 (f09908d) into master (2795815) will increase coverage by 0.02%.
The diff coverage is 88.23%.

@@            Coverage Diff             @@
##           master    #4518      +/-   ##
==========================================
+ Coverage   98.74%   98.77%   +0.02%     
==========================================
  Files         208      208              
  Lines        7437     7432       -5     
  Branches     2124     2130       +6     
==========================================
- Hits         7344     7341       -3     
+ Misses         34       32       -2     
  Partials       59       59              
Impacted Files Coverage Δ
src/ast/nodes/AssignmentExpression.ts 100.00% <ø> (ø)
src/ast/nodes/AssignmentPattern.ts 100.00% <ø> (ø)
src/ast/nodes/AwaitExpression.ts 100.00% <ø> (ø)
src/ast/nodes/ClassBody.ts 100.00% <ø> (ø)
src/ast/nodes/ExportAllDeclaration.ts 100.00% <ø> (ø)
src/ast/nodes/ExportDefaultDeclaration.ts 100.00% <ø> (ø)
src/ast/nodes/ExportNamedDeclaration.ts 100.00% <ø> (ø)
src/ast/nodes/ExpressionStatement.ts 87.50% <ø> (ø)
src/ast/nodes/ForInStatement.ts 100.00% <ø> (ø)
src/ast/nodes/ForOfStatement.ts 100.00% <ø> (ø)
... and 27 more

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 2795815...f09908d. Read the comment docs.

@lukastaegert lukastaegert merged commit d25b6e2 into master May 31, 2022
@lukastaegert lukastaegert deleted the gh-4516_deoptimize_defaults branch May 31, 2022 11:18
pos777 pushed a commit to pos777/rollup that referenced this pull request Jun 18, 2022
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.

Parameter's default value is removed when it's not supposed to
1 participant