From 92212ae19e5fe9290cf68bcf220aa0a3f4741b65 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sun, 6 Oct 2019 10:06:40 -0700 Subject: [PATCH] More succinct --- src/compiler/checker.ts | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 0e46fd76497..6931ff45445 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -18802,18 +18802,9 @@ namespace ts { function isFalseExpression(expr: Expression): boolean { const node = skipParentheses(expr); - if (node.kind === SyntaxKind.FalseKeyword) { - return true; - } - if (node.kind === SyntaxKind.BinaryExpression) { - if ((node).operatorToken.kind === SyntaxKind.AmpersandAmpersandToken) { - return isFalseExpression((node).left) || isFalseExpression((node).right); - } - if ((node).operatorToken.kind === SyntaxKind.BarBarToken) { - return isFalseExpression((node).left) && isFalseExpression((node).right); - } - } - return false; + return node.kind === SyntaxKind.FalseKeyword || node.kind === SyntaxKind.BinaryExpression && ( + (node).operatorToken.kind === SyntaxKind.AmpersandAmpersandToken && (isFalseExpression((node).left) || isFalseExpression((node).right)) || + (node).operatorToken.kind === SyntaxKind.BarBarToken && isFalseExpression((node).left) && isFalseExpression((node).right)); } function isReachableFlowNodeWorker(flow: FlowNode, noCacheCheck: boolean): boolean {