Merge pull request #8829 from Microsoft/tslintPerf

add a extra check to avoid rescans in Node.getStart
This commit is contained in:
Vladimir Matveev 2016-05-25 16:54:25 -07:00
commit df4ab083f4
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();