Async code fix issues concerning underscores and nested promises#27156
Merged
uniqueiniquity merged 12 commits intomicrosoft:masterfrom Sep 18, 2018
Merged
Async code fix issues concerning underscores and nested promises#27156uniqueiniquity merged 12 commits intomicrosoft:masterfrom
uniqueiniquity merged 12 commits intomicrosoft:masterfrom
Conversation
Member
|
Would it be interesting to test the case where the handler returns a promise of a promise? |
amcasey
reviewed
Sep 17, 2018
amcasey
reviewed
Sep 17, 2018
amcasey
reviewed
Sep 17, 2018
ghost
reviewed
Sep 17, 2018
|
|
||
| function createVariableDeclarationOrAssignment(prevArgName: SynthIdentifier, rightHandSide: Expression, transformer: Transformer): NodeArray<Statement> { | ||
| function createVariableDeclarationOrAssignment(prevArgName: SynthIdentifier | undefined, rightHandSide: Expression, transformer: Transformer): NodeArray<Statement> { | ||
| if (!prevArgName || prevArgName.identifier.text.length === 0) { |
There was a problem hiding this comment.
When does the second condition here ever happen? Shouldn't we just avoid synthesizing an empty identifier in the first place?
Contributor
Author
There was a problem hiding this comment.
Sure. There's a place in the code here where we explicitly do that, but I can find another way to handle that case.
amcasey
reviewed
Sep 17, 2018
ghost
approved these changes
Sep 17, 2018
amcasey
approved these changes
Sep 18, 2018
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 #27112.
If the handler function for a promise itself returns a promise, then the value of the outer promise is resolved to the value of the inner. However, currently the async code fix does not wrap await the inner promise in this situation. This PR changes the behavior so that if the handler of a promise that's being fixed returns a promise, an
awaitis added.Additionally, this PR fixes an issue where if a promise handler doesn't have a bound parameter name (e.g.,
_), then the preceding promise handler would be deleted. This caused issues when the previous promise handler had side effects.