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.
When hoisting a var, use UNKNOWN_EXPRESSION as the initializer instead
of the actual one. This prevents the initializer from being used during
the optimization step when it hasn't yet been assigned at runtime.
This PR contains:
Are tests included?
Breaking Changes?
List any relevant issue numbers:
#2606
Description
The bug is described in #2606. I more-or-less copied the examples as new test cases.
I'm not able to run the
watch
tests on my FreeBSD box, but the rest ofnpm test
runs without error post-patch. The codebase was kind of hard for me to follow so grains of salt.The patch is also sub-optimal in that it prevents the optimizer from figuring out that hoisted variables from trimmed branches are falsy, but I couldn't work out a way to plumb that through.