Treeshake sequence expression - #1650
Merged
lukastaegert merged 2 commits intoOct 6, 2017
Merged
Conversation
- if the test evaluation produces an effect, keep the whole expression - if the test evaluation is unkown but has no effect, remove the expression unless any branch has an effect - if the test evaluation is known, replace the expression with the resulting branch (as before)
Contributor
|
Is #1648 a superset of this PR? |
lukastaegert
approved these changes
Sep 28, 2017
lukastaegert
left a comment
Member
There was a problem hiding this comment.
I really like this! No objections to merging this.
Member
|
@kzc It looks like it but from my side we should merge both anyway. |
Contributor
Author
Contributor
|
@corneliusweig A combined PR would be helpful as it's a bit confusing. Thanks. The individual commits need not be collapsed. |
Looks at each expression in the sequence and only retains the node if it has an effect. Note: in sequence expressions with effects always keep the last node, to be consistent when assigning the resulting value to a variable.
corneliusweig
force-pushed
the
treeshake-sequence-expression
branch
from
September 29, 2017 15:08
ecf1b89 to
e5eb0ea
Compare
Contributor
Author
Member
|
Since this is not a breaking change and I really want this to be in the master before I make my next PR I will merge this now. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This resolves #1649
The resulting code may have spurious parentheses that wrapped the sequence. For example
var a = (1,2,3)becomesvar a = (3)instead ofvar a = 3. Other than that, all cases covered in #1649 are covered.