From add7c1a6647bcd97cf6e45f7a59b75583c4c713b Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Tue, 13 Sep 2016 11:50:37 -0700 Subject: [PATCH] Flip check, add SEF cases --- src/compiler/checker.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index c06cf679f6d..6eddd2c6a20 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -13257,6 +13257,8 @@ namespace ts { case SyntaxKind.Identifier: case SyntaxKind.StringLiteral: case SyntaxKind.RegularExpressionLiteral: + case SyntaxKind.TaggedTemplateExpression: + case SyntaxKind.TemplateExpression: case SyntaxKind.NoSubstitutionTemplateLiteral: case SyntaxKind.NumericLiteral: case SyntaxKind.TrueKeyword: @@ -13264,6 +13266,7 @@ namespace ts { case SyntaxKind.NullKeyword: case SyntaxKind.UndefinedKeyword: case SyntaxKind.FunctionExpression: + case SyntaxKind.ClassExpression: case SyntaxKind.ArrowFunction: case SyntaxKind.ArrayLiteralExpression: case SyntaxKind.ObjectLiteralExpression: @@ -13465,7 +13468,7 @@ namespace ts { checkAssignmentOperator(rightType); return getRegularTypeOfObjectLiteral(rightType); case SyntaxKind.CommaToken: - if (isSideEffectFree(left) && !compilerOptions.allowUnreachableCode) { + if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left)) { error(left, Diagnostics.Left_side_of_comma_operator_is_unused_and_has_no_side_effects); } return rightType;