diff options
author | Florian Dold <florian.dold@gmail.com> | 2018-09-20 02:56:13 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2018-09-20 02:56:13 +0200 |
commit | bbff7403fbf46f9ad92240ac213df8d30ef31b64 (patch) | |
tree | c58400ec5124da1c7d56b01aea83309f80a56c3b /node_modules/tslint/lib/rules/noDuplicateSuperRule.js | |
parent | 003fb34971cf63466184351b4db5f7c67df4f444 (diff) |
update packages
Diffstat (limited to 'node_modules/tslint/lib/rules/noDuplicateSuperRule.js')
-rw-r--r-- | node_modules/tslint/lib/rules/noDuplicateSuperRule.js | 13 |
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: |