Ensure async code fix renaming can do more than one rename#27031
Merged
uniqueiniquity merged 13 commits intomicrosoft:masterfrom Sep 14, 2018
Merged
Ensure async code fix renaming can do more than one rename#27031uniqueiniquity merged 13 commits intomicrosoft:masterfrom
uniqueiniquity merged 13 commits intomicrosoft:masterfrom
Conversation
ghost
reviewed
Sep 12, 2018
src/services/utilities.ts
Outdated
|
|
||
| if (clone && !includeTrivia) suppressLeadingAndTrailingTrivia(clone); | ||
| if (callback && node) callback(node!, clone); | ||
| if (callback && node && clone) callback(node!, clone); |
There was a problem hiding this comment.
Looks like this wasn't detected due to a compiler bug. #27050
tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_InnerVarNameConflict.ts
Show resolved
Hide resolved
ghost
approved these changes
Sep 12, 2018
Member
Maybe return early if Refers to: src/services/utilities.ts:1657 in 95e5f7d. [](commit_id = 95e5f7d, deletion_comment = False) |
amcasey
reviewed
Sep 13, 2018
amcasey
reviewed
Sep 13, 2018
tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_bindingPattern.ts
Outdated
Show resolved
Hide resolved
amcasey
reviewed
Sep 13, 2018
| // ==ASYNC FUNCTION::Convert to async function== | ||
|
|
||
| async function f() { | ||
| let x_2; |
Member
There was a problem hiding this comment.
x_2 [](start = 5, length = 3)
Nit: It's kind of weird that the catch parameter got "1".
Contributor
Author
There was a problem hiding this comment.
That's just because we rename from left to right in the pre-fixed form. Not sure if that's worth fixing at this point.
amcasey
reviewed
Sep 13, 2018
tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_MultipleReturns2.ts
Outdated
Show resolved
Hide resolved
amcasey
reviewed
Sep 13, 2018
amcasey
reviewed
Sep 14, 2018
| numberOfAssignmentsOriginal: number; | ||
| } | ||
|
|
||
| interface SymbolAndIdentifier { |
Member
There was a problem hiding this comment.
As we discussed offline, this might be more readable if the original names were tracked in a frequency table on the side.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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 #26376.
Currently, if we are performing an async code fix, we inspect each variable to see if it will collide with any other variables used after the code has been changed. However, for a conflicting variable
foo, we will always rename itfoo_1, even if another variable has also been renamed tofoo_1. This PR stores the original names of variables during the rename operation so that the numbering can be done correctly.