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

Move long path recursion prevention to MemberExpression #4189

Merged
merged 2 commits into from Jul 25, 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 #4184

Description

This resolves a regression reported when calling class methods that themselves call methods on "this". Here it was possible that Rollup was trying to deoptimize an infinite object path (basically .prototype.prototype.prototype...). This is resolved by moving the logic to prevent these things from the LocalVariable class to the MemberExpression class as the latter is actually the one responsible for the issue.

@github-actions
Copy link

github-actions bot commented Jul 24, 2021

Thank you for your contribution! ❤️

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

npm install rollup/rollup#gh-4184-deoptimization-recursion

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

@codecov
Copy link

codecov bot commented Jul 24, 2021

Codecov Report

Merging #4189 (c00cc93) into master (2a29db9) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #4189   +/-   ##
=======================================
  Coverage   98.34%   98.34%           
=======================================
  Files         202      202           
  Lines        7232     7245   +13     
  Branches     2116     2123    +7     
=======================================
+ Hits         7112     7125   +13     
  Misses         58       58           
  Partials       62       62           
Impacted Files Coverage Δ
src/ast/nodes/MemberExpression.ts 100.00% <100.00%> (ø)
src/ast/nodes/shared/ObjectMember.ts 90.00% <100.00%> (ø)
src/ast/variables/LocalVariable.ts 93.15% <100.00%> (-0.10%) ⬇️

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 2a29db9...c00cc93. Read the comment docs.

@lukastaegert lukastaegert force-pushed the gh-4184-deoptimization-recursion branch from af90dc4 to 6ca5536 Compare July 24, 2021 05:39
@lukastaegert lukastaegert force-pushed the gh-4184-deoptimization-recursion branch from 6ca5536 to c00cc93 Compare July 25, 2021 05:05
@lukastaegert lukastaegert merged commit 08655bc into master Jul 25, 2021
@lukastaegert lukastaegert deleted the gh-4184-deoptimization-recursion branch July 25, 2021 05:11
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.

Regression for ESM imported classes
1 participant