Fix regression causing incomplete nullish coalesce in some cases #610
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.
Fixes #609
The original implementation of the Jest transform (#540) needed to remove
regions of code, but ran into issues with the optional chaining and nullish
coalescing transforms, since those transforms would still emit function calls
around tokens even if they were removed. The implementation fixed those issues
by disabling the optional chaining and nullish coalescing code emit in
removeToken
andremoveInitialToken
. Unfortunately, this broke other cases,like a nullish coalescing call immediately followed by a type token. The nullish
coalescing implementation expected
appendTokenSuffix
to be called on the lasttoken even though it was a type token.
The changes to
TokenProcessor
actually became unnecessary as of #608 since weno longer are deleting a region of code, so I reverted the two methods back to
their original implementation, which fixes the issue.