Ensure visitor visits the awaitModifier of a ForOfStatement (#21078)
This commit is contained in:
parent
9efb3ac3a7
commit
c4d76292f1
|
@ -622,7 +622,7 @@ namespace ts {
|
|||
|
||||
case SyntaxKind.ForOfStatement:
|
||||
return updateForOf(<ForOfStatement>node,
|
||||
(<ForOfStatement>node).awaitModifier,
|
||||
visitNode((<ForOfStatement>node).awaitModifier, visitor, isToken),
|
||||
visitNode((<ForOfStatement>node).initializer, visitor, isForInitializer),
|
||||
visitNode((<ForOfStatement>node).expression, visitor, isExpression),
|
||||
visitNode((<ForOfStatement>node).statement, visitor, isStatement, liftToBlock));
|
||||
|
|
25
tests/cases/fourslash/extractMethod_forAwait.ts
Normal file
25
tests/cases/fourslash/extractMethod_forAwait.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
////async function f(xs: AsyncIterable<number>) {
|
||||
//// /*a*/for await (const x of xs) {
|
||||
//// x * 2;
|
||||
//// }/*b*/
|
||||
////}
|
||||
|
||||
goTo.select('a', 'b')
|
||||
edit.applyRefactor({
|
||||
refactorName: "Extract Symbol",
|
||||
actionName: "function_scope_1",
|
||||
actionDescription: "Extract to function in global scope",
|
||||
newContent:
|
||||
`async function f(xs: AsyncIterable<number>) {
|
||||
/*RENAME*/newFunction(xs);
|
||||
}
|
||||
|
||||
function newFunction(xs: any) {
|
||||
for await (const x of xs) {
|
||||
x * 2;
|
||||
}
|
||||
}
|
||||
`
|
||||
});
|
Loading…
Reference in a new issue