mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-17 12:19:32 -05:00
Fixed an issue with broken await using declarations in for of loops (#56466)
Co-authored-by: Jake Bailey <5341706+jakebailey@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
389b579a83
commit
60991e0021
@@ -50935,7 +50935,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
ExportAssignment,
|
||||
ExportSpecifier,
|
||||
Expression,
|
||||
firstOrUndefined,
|
||||
ForOfStatement,
|
||||
ForStatement,
|
||||
GeneratedIdentifierFlags,
|
||||
@@ -305,11 +306,7 @@ export function transformESNext(context: TransformationContext): (x: SourceFile
|
||||
//
|
||||
// before handing the shallow transformation back to the visitor for an in-depth transformation.
|
||||
const forInitializer = node.initializer;
|
||||
Debug.assertNode(forInitializer, isUsingVariableDeclarationList);
|
||||
Debug.assert(forInitializer.declarations.length === 1, "ForInitializer may only have one declaration");
|
||||
|
||||
const forDecl = forInitializer.declarations[0];
|
||||
Debug.assert(!forDecl.initializer, "ForInitializer may not have an initializer");
|
||||
const forDecl = firstOrUndefined(forInitializer.declarations) || factory.createVariableDeclaration(factory.createTempVariable(/*recordTempVariable*/ undefined));
|
||||
|
||||
const isAwaitUsing = getUsingKindOfVariableDeclarationList(forInitializer) === UsingKind.Async;
|
||||
const temp = factory.getGeneratedNameForNode(forDecl.name);
|
||||
|
||||
Reference in New Issue
Block a user