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

Fix regressions when handling assignments and expression statements with side effects #1591

Merged
merged 3 commits into from Aug 29, 2017

Conversation

lukastaegert
Copy link
Member

@lukastaegert lukastaegert commented Aug 28, 2017

This will resolve #1589 and #1592.

For #1589: In Identifier.js, I assumed that all declarations have assignedExpressions, which is certainly not true for SyntheticNamespaceDeclarations. To be cautious, for now we assume that those always have effects when mutated.

For #1592: It seems that people are calling getters for side-effects and this is something that rollup is not (and was never) prepared for yet. The better solution, as suggested by @kzc , is probably to start adding flags for certain more aggressive aspects of tree-shaking such as assuming that all getters are pure. Until then with this PR, rollup will keep all expression statements that are not usually called as statements because we assume that they are called for side-effects. That seems to cover the cases listed in #1592 and also keep things like 'use strict'.

* Except for certain white-listed nodes, assume that a side-effect is
  expected when an expression is called as a statement
@lukastaegert lukastaegert changed the title Fix minor regression when handling assignments Fix regressions when handling assignments and expression statements with side effects Aug 29, 2017
@Rich-Harris Rich-Harris merged commit 8bcf04a into rollup:master Aug 29, 2017
@lukastaegert lukastaegert deleted the fix-more-regressions branch August 30, 2017 10:56
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.

[v0.49.1] TypeError: Cannot convert undefined or null to object
2 participants