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

Do not track side-effect-free array methods as side effects #4103

Merged
merged 1 commit into from May 27, 2021

Conversation

lukastaegert
Copy link
Member

@lukastaegert lukastaegert commented May 27, 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:
#4100 (but does not fully resolve it)

Description

This will no longer track calling array builtin methods such as filter as side-effects: REPL

Note that when the array itself is later passed to a function (like console.log), Rollup will still optimise as it cannot track if the filter methods was overwritten.

@github-actions
Copy link

Thank you for your contribution! ❤️

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

npm install rollup/rollup#gh-4100-no-side-effect-array-methods

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

@codecov
Copy link

codecov bot commented May 27, 2021

Codecov Report

Merging #4103 (9473af9) into master (9a50fbb) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #4103   +/-   ##
=======================================
  Coverage   98.02%   98.02%           
=======================================
  Files         201      201           
  Lines        7036     7037    +1     
  Branches     2063     2063           
=======================================
+ Hits         6897     6898    +1     
  Misses         66       66           
  Partials       73       73           
Impacted Files Coverage Δ
src/ast/nodes/shared/MethodTypes.ts 78.57% <ø> (ø)
src/ast/nodes/shared/ArrayPrototype.ts 100.00% <100.00%> (ø)

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 9a50fbb...9473af9. Read the comment docs.

@lukastaegert lukastaegert merged commit df3b2a5 into master May 27, 2021
@lukastaegert lukastaegert deleted the gh-4100-no-side-effect-array-methods branch May 27, 2021 11:02
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.

None yet

1 participant