Skip to content

Commit 1bfc472

Browse files
Merge pull request microsoft#33938 from uniqueiniquity/classifcationAssertion
Add assertion when classification has unexpected length
2 parents 0fc3888 + 65561a8 commit 1bfc472

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/services/classifier.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,8 +499,10 @@ namespace ts {
499499
return { spans, endOfLineState: EndOfLineState.None };
500500

501501
function pushClassification(start: number, end: number, type: ClassificationType): void {
502+
const length = end - start;
503+
Debug.assert(length > 0, `Classification had non-positive length of ${length}`);
502504
spans.push(start);
503-
spans.push(end - start);
505+
spans.push(length);
504506
spans.push(type);
505507
}
506508
}

0 commit comments

Comments
 (0)