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

Improve side-effect tracking for call arguments #3539

Merged
merged 1 commit into from
May 7, 2020

Conversation

lukastaegert
Copy link
Member

…tracked side-effects in nested calls

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

Description

See #3533. In this situation, the tracking logic that is meant to prevent infinite recursions in Rollup's side-effect detection would fire for the inner .forEach call expression because it thought this call had already been tracked as it was the same variable and path of the outer .forEach call. Of course this is not the case, so for call expressions, the recursion prevention logic will now also discriminate based on original call expression and not only variable.

@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-3533-nested-call-side-effects

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

@codecov
Copy link

codecov bot commented May 7, 2020

Codecov Report

Merging #3539 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3539   +/-   ##
=======================================
  Coverage   96.24%   96.24%           
=======================================
  Files         176      176           
  Lines        6014     6023    +9     
  Branches     1773     1775    +2     
=======================================
+ Hits         5788     5797    +9     
  Misses        112      112           
  Partials      114      114           
Impacted Files Coverage Δ
src/ast/ExecutionContext.ts 100.00% <ø> (ø)
src/ast/nodes/CallExpression.ts 95.41% <ø> (ø)
src/ast/nodes/Property.ts 92.30% <ø> (ø)
src/ast/variables/LocalVariable.ts 89.01% <ø> (ø)
src/ast/utils/PathTracker.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 35b0f78...def5201. Read the comment docs.

@lukastaegert lukastaegert merged commit a2b961d into master May 7, 2020
@lukastaegert lukastaegert deleted the gh-3533-nested-call-side-effects branch May 7, 2020 04:05
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.

Rollup lost an entire piece of code
2 participants