Merge pull request #3092 from Microsoft/classificationLoop1.5

Prevent infinite loop when classifying.
This commit is contained in:
CyrusNajmabadi
2015-05-08 13:59:49 -07:00

View File

@@ -6039,11 +6039,13 @@ module ts {
let end = triviaScanner.getTextPos();
let width = end - start;
if (textSpanIntersectsWith(span, start, width)) {
if (!isTrivia(kind)) {
return;
}
// The moment we get something that isn't trivia, then stop processing.
if (!isTrivia(kind)) {
return;
}
// Only bother with the trivia if it at least intersects the span of interest.
if (textSpanIntersectsWith(span, start, width)) {
if (isComment(kind)) {
// Simple comment. Just add as is.
pushClassification(start, width, ClassificationType.comment);