Remove unnecessary test (#22962)

This commit is contained in:
Andy
2018-03-29 07:54:20 -07:00
committed by GitHub
parent e40f2943b1
commit 57e28dfb4f

View File

@@ -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