Refactor call handling - #1624
Merged
Merged
Conversation
future) that make immutability easier to handle * Properly tree-shake generator functions without side-effects that have been called to provide an iterator at least as long as iteration has not yet started
a little IDE support
identifiers handle the proxy generation
…ements * Fix an issue when tree-shaking is of where namespace imports were not replaced properly
* Move the job of declaring variables on the scope to the individual Identifiers * Extract Variable types and refactor * In order to find out if a variable has an effect when mutated, ask it! * Now var statements should be correctly associated (test pending)
* For nodes: includeDeclaration -> includeWithAllDeclarations * Scope.findDeclaration -> findVariable
values are correctly associated
* No special handling for this-values for now * Finally eliminate callHasEffects and gatherPossibleValues * Side-effects across namespace imports are now properly detected! (dedicated test is pending)
namespace props.
to make clear these are meant to be called during .bind() * Create dedicated FunctionBodyScope for non-ArrowFunctions that adds arguments and will in the future handle "this" values
Member
Author
|
For some reason when rebasing/merging, some commits were added twice so the list of commits might look a little bloated... |
This was referenced Sep 11, 2017
* Prevent crashes for mutations of cyclic assignments * Resolve rollup#1627
arguments and return value are (should also improve IDE support) and to explain, when and how each function should be overridden
not always register all side effects.
* Resolves rollup#674 * Closes rollup#677 * Resolves rollup#1235
value to their left side has an effect.
patterns, both the right side as well as any initial assignment are assigned to the left side.
lukastaegert
force-pushed
the
refactor-call-handling
branch
from
September 13, 2017 04:21
7db70a6 to
f964dfb
Compare
Contributor
Member
Author
|
Actually, "resolve" and "close" also work quite well but I prefer to do it via the individual commits, that way the commit gets linked to the issue 😉 |
Member
Author
|
But good point, added a comment for #1631. |
Contributor
|
🎉🎉🎉🎉🎉 amazing work as ever, thank you! |
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.
So it here is, my second huge refactoring PR. This time, the focus is on refactoring the side-effect detection for calls and instantiations, something I had left out of the previous PR. Besides, quite a few issues will be fixed as well: #674, #677, #1187, #1235, #1289, #1391, #1615, #1622
Improved results
This time the list of tests that have been added/changed and now produce different (and correct) results is REALLY long, so instead I will just list the highlights and you may check for yourself:
namespace-optimization-computed-string, the several times re-exported but side-effect free function is now properly removed so the test needed to be adapted :)redeclarationsUNKNOWN_LITERALandUNKNOWN_ASSIGNMENTbut in the future we might start putting much more information here. The values of "this" are set during.bind()time.side-effects-generatorsFunctionScopehave been added. Now functions actually create two new scopes: one for their parameters and one for their body. This resolves some elusive bugs.Other refactorings
Nodenow has JSDoc comments describing the parameter types, return values and how and when to overwrite the individual methods. This should help others in determining what needs to be changed if they want to fix something via PR.Variable; variables can be tested for certain effectsHave fun & I hope this works for everyone!