mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-11 01:34:55 -06:00
Merge pull request #3091 from Microsoft/classificationLoop
Prevent infinite loop when classifying.
This commit is contained in:
commit
5aed73ff72
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user