mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 01:04:49 -05:00
Remove unnecessary test (#22962)
This commit is contained in:
@@ -22501,19 +22501,17 @@ namespace ts {
|
||||
function checkForOfStatement(node: ForOfStatement): void {
|
||||
checkGrammarForInOrForOfStatement(node);
|
||||
|
||||
if (node.kind === SyntaxKind.ForOfStatement) {
|
||||
if (node.awaitModifier) {
|
||||
const functionFlags = getFunctionFlags(getContainingFunction(node));
|
||||
if ((functionFlags & (FunctionFlags.Invalid | FunctionFlags.Async)) === FunctionFlags.Async && languageVersion < ScriptTarget.ESNext) {
|
||||
// for..await..of in an async function or async generator function prior to ESNext requires the __asyncValues helper
|
||||
checkExternalEmitHelpers(node, ExternalEmitHelpers.ForAwaitOfIncludes);
|
||||
}
|
||||
}
|
||||
else if (compilerOptions.downlevelIteration && languageVersion < ScriptTarget.ES2015) {
|
||||
// for..of prior to ES2015 requires the __values helper when downlevelIteration is enabled
|
||||
checkExternalEmitHelpers(node, ExternalEmitHelpers.ForOfIncludes);
|
||||
if (node.awaitModifier) {
|
||||
const functionFlags = getFunctionFlags(getContainingFunction(node));
|
||||
if ((functionFlags & (FunctionFlags.Invalid | FunctionFlags.Async)) === FunctionFlags.Async && languageVersion < ScriptTarget.ESNext) {
|
||||
// for..await..of in an async function or async generator function prior to ESNext requires the __asyncValues helper
|
||||
checkExternalEmitHelpers(node, ExternalEmitHelpers.ForAwaitOfIncludes);
|
||||
}
|
||||
}
|
||||
else if (compilerOptions.downlevelIteration && languageVersion < ScriptTarget.ES2015) {
|
||||
// for..of prior to ES2015 requires the __values helper when downlevelIteration is enabled
|
||||
checkExternalEmitHelpers(node, ExternalEmitHelpers.ForOfIncludes);
|
||||
}
|
||||
|
||||
// Check the LHS and RHS
|
||||
// If the LHS is a declaration, just check it as a variable declaration, which will in turn check the RHS
|
||||
|
||||
Reference in New Issue
Block a user