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

Tree-shake pure call expressions with optional chaining #4007

Merged
merged 1 commit into from Mar 22, 2021

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

Description

Not really a bug fix but rather an oversight: Since optional chaining call expressions are wrapped in a "ChainExpression" node, the existing logic for marking pure call expressions was skipping it. This is fixed now.

@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-4006_treeshake_pure_optional_chaining_call

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

@codecov
Copy link

codecov bot commented Mar 22, 2021

Codecov Report

Merging #4007 (6155b4f) into master (b8db675) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #4007   +/-   ##
=======================================
  Coverage   97.24%   97.24%           
=======================================
  Files         192      192           
  Lines        6759     6760    +1     
  Branches     1973     1973           
=======================================
+ Hits         6573     6574    +1     
  Misses         99       99           
  Partials       87       87           
Impacted Files Coverage Δ
src/utils/pureComments.ts 100.00% <100.00%> (ø)
src/ast/nodes/NodeType.ts 100.00% <0.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 b8db675...6155b4f. Read the comment docs.

@lukastaegert lukastaegert merged commit ddc5e82 into master Mar 22, 2021
@lukastaegert lukastaegert deleted the gh-4006_treeshake_pure_optional_chaining_call branch March 22, 2021 14:44
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.

Tree shaking: pure function not detected with optional chaining
2 participants