diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-12-10 21:51:33 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-12-10 21:51:33 +0100 |
commit | 0469abd4a9c9270a1fdc962969e36e63699af8b4 (patch) | |
tree | f9864d4a4148621378958794cbbfdc2393733283 /node_modules/tslint/lib/rules/onlyArrowFunctionsRule.js | |
parent | 6947e79bbc258f7bc96af424ddb71a511f0c15a3 (diff) |
upgrade dependencies
Diffstat (limited to 'node_modules/tslint/lib/rules/onlyArrowFunctionsRule.js')
-rw-r--r-- | node_modules/tslint/lib/rules/onlyArrowFunctionsRule.js | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/node_modules/tslint/lib/rules/onlyArrowFunctionsRule.js b/node_modules/tslint/lib/rules/onlyArrowFunctionsRule.js index 36239c5b8..7af04a45b 100644 --- a/node_modules/tslint/lib/rules/onlyArrowFunctionsRule.js +++ b/node_modules/tslint/lib/rules/onlyArrowFunctionsRule.js @@ -84,14 +84,11 @@ function walk(ctx) { } /** Generator functions and functions using `this` are allowed. */ function functionIsExempt(node) { - return node.asteriskToken !== undefined || hasThisParameter(node) || node.body !== undefined && usesThisInBody(node.body) === true; + return node.asteriskToken !== undefined || + node.parameters.length !== 0 && utils.isThisParameter(node.parameters[0]) || + node.body !== undefined && ts.forEachChild(node, usesThis) === true; } -function hasThisParameter(node) { - var first = node.parameters[0]; - return first !== undefined && first.name.kind === ts.SyntaxKind.Identifier && - first.name.originalKeywordKind === ts.SyntaxKind.ThisKeyword; -} -function usesThisInBody(node) { - return node.kind === ts.SyntaxKind.ThisKeyword || !utils.hasOwnThisReference(node) && ts.forEachChild(node, usesThisInBody); +function usesThis(node) { + return node.kind === ts.SyntaxKind.ThisKeyword || !utils.hasOwnThisReference(node) && ts.forEachChild(node, usesThis); } var _a; |