aboutsummaryrefslogtreecommitdiff
path: root/node_modules/tslint/lib/rules/noDuplicateSuperRule.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/tslint/lib/rules/noDuplicateSuperRule.js')
-rw-r--r--node_modules/tslint/lib/rules/noDuplicateSuperRule.js13
1 files changed, 11 insertions, 2 deletions
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: