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