From bbff7403fbf46f9ad92240ac213df8d30ef31b64 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Thu, 20 Sep 2018 02:56:13 +0200 Subject: update packages --- node_modules/tslint/lib/rules/noDuplicateSuperRule.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'node_modules/tslint/lib/rules/noDuplicateSuperRule.js') diff --git a/node_modules/tslint/lib/rules/noDuplicateSuperRule.js b/node_modules/tslint/lib/rules/noDuplicateSuperRule.js index 39e07d472..b1e545f48 100644 --- a/node_modules/tslint/lib/rules/noDuplicateSuperRule.js +++ b/node_modules/tslint/lib/rules/noDuplicateSuperRule.js @@ -53,7 +53,7 @@ function walk(ctx) { return ts.forEachChild(node, cb); }); function getSuperForNode(node) { - if (Lint.isLoop(node)) { + if (tsutils_1.isIterationStatement(node)) { var bodySuper = combineSequentialChildren(node); if (typeof bodySuper === "number") { return 0 /* NoSuper */; @@ -77,8 +77,17 @@ function walk(ctx) { return node.parent.kind === ts.SyntaxKind.CallExpression && node.parent.expression === node ? { node: node.parent, break: false } : 0 /* NoSuper */; + case ts.SyntaxKind.ConditionalExpression: { + var _a = node, condition = _a.condition, whenTrue = _a.whenTrue, whenFalse = _a.whenFalse; + var inCondition = getSuperForNode(condition); + var inBranches = worse(getSuperForNode(whenTrue), getSuperForNode(whenFalse)); + if (typeof inCondition !== "number" && typeof inBranches !== "number") { + addDuplicateFailure(inCondition.node, inBranches.node); + } + return worse(inCondition, inBranches); + } case ts.SyntaxKind.IfStatement: { - var _a = node, thenStatement = _a.thenStatement, elseStatement = _a.elseStatement; + var _b = node, thenStatement = _b.thenStatement, elseStatement = _b.elseStatement; return worse(getSuperForNode(thenStatement), elseStatement !== undefined ? getSuperForNode(elseStatement) : 0 /* NoSuper */); } case ts.SyntaxKind.SwitchStatement: -- cgit v1.2.3