File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -622,6 +622,7 @@ namespace ts.server {
622
622
}
623
623
624
624
positionToLineOffset ( position : number ) : protocol . Location {
625
+ failIfInvalidPosition ( position ) ;
625
626
const location = this . textStorage . positionToLineOffset ( position ) ;
626
627
failIfInvalidLocation ( location ) ;
627
628
return location ;
@@ -645,7 +646,11 @@ namespace ts.server {
645
646
}
646
647
}
647
648
648
- /*@internal */
649
+ function failIfInvalidPosition ( position : number ) {
650
+ Debug . assert ( typeof position === "number" , `Expected position ${ position } to be a number.` ) ;
651
+ Debug . assert ( position >= 0 , `Expected position to be non-negative.` ) ;
652
+ }
653
+
649
654
function failIfInvalidLocation ( location : protocol . Location ) {
650
655
Debug . assert ( typeof location . line === "number" , `Expected line ${ location . line } to be a number.` ) ;
651
656
Debug . assert ( typeof location . offset === "number" , `Expected offset ${ location . offset } to be a number.` ) ;
You can’t perform that action at this time.
0 commit comments