From 57e28dfb4f57045bede2670f972bde6b8e00b248 Mon Sep 17 00:00:00 2001 From: Andy Date: Thu, 29 Mar 2018 07:54:20 -0700 Subject: [PATCH] Remove unnecessary test (#22962) --- src/compiler/checker.ts | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 8850e83a808..fe29a7a3f13 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -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