add a extra check to avoid rescans

This commit is contained in:
Vladimir Matveev 2016-05-25 12:25:53 -07:00
parent f5a52ee7db
commit b3531b0158
2 changed files with 4 additions and 1 deletions

View File

@ -18,7 +18,7 @@ class BooleanTriviaWalker extends Lint.RuleWalker {
visitCallExpression(node: ts.CallExpression) {
super.visitCallExpression(node);
if (node.arguments) {
if (node.arguments && node.arguments.some(arg => arg.kind === ts.SyntaxKind.TrueKeyword || arg.kind === ts.SyntaxKind.FalseKeyword)) {
const targetCallSignature = this.checker.getResolvedSignature(node);
if (!!targetCallSignature) {
const targetParameters = targetCallSignature.getParameters();

View File

@ -267,6 +267,9 @@ namespace ts {
// find the child that contains 'position'
for (let i = 0, n = current.getChildCount(sourceFile); i < n; i++) {
const child = current.getChildAt(i);
if (position < child.getFullStart() || position > child.getEnd()) {
continue;
}
const start = allowPositionInLeadingTrivia ? child.getFullStart() : child.getStart(sourceFile);
if (start <= position) {
const end = child.getEnd();