@@ -4510,24 +4510,23 @@ const enum State {
45104510 inObjectMarker
45114511}
45124512
4513- function reportError ( fileName : string , line : number , col : number , message : string ) {
4513+ function reportError ( fileName : string , line : number , col : number , message : string ) : never {
45144514 const errorMessage = fileName + "(" + line + "," + col + "): " + message ;
45154515 throw new Error ( errorMessage ) ;
45164516}
45174517
45184518function recordObjectMarker ( fileName : string , location : LocationInformation , text : string , markerMap : Map < string , Marker > , markers : Marker [ ] ) : Marker | undefined {
4519- let markerValue : any ;
4519+ let markerValue ;
45204520 try {
45214521 // Attempt to parse the marker value as JSON
4522- markerValue = JSON . parse ( "{ " + text + " }" ) ;
4522+ markerValue = JSON . parse ( "{ " + text + " }" ) as { name ?: unknown } ;
45234523 }
45244524 catch ( e ) {
45254525 reportError ( fileName , location . sourceLine , location . sourceColumn , "Unable to parse marker text " + e . message ) ;
45264526 }
45274527
45284528 if ( markerValue === undefined ) {
45294529 reportError ( fileName , location . sourceLine , location . sourceColumn , "Object markers can not be empty" ) ;
4530- return undefined ;
45314530 }
45324531
45334532 const marker : Marker = {
@@ -4537,7 +4536,7 @@ function recordObjectMarker(fileName: string, location: LocationInformation, tex
45374536 } ;
45384537
45394538 // Object markers can be anonymous
4540- if ( markerValue . name ) {
4539+ if ( typeof markerValue . name === "string" ) {
45414540 markerMap . set ( markerValue . name , marker ) ;
45424541 }
45434542
@@ -4556,7 +4555,6 @@ function recordMarker(fileName: string, location: LocationInformation, name: str
45564555 if ( markerMap . has ( name ) ) {
45574556 const message = "Marker '" + name + "' is duplicated in the source file contents." ;
45584557 reportError ( marker . fileName , location . sourceLine , location . sourceColumn , message ) ;
4559- return undefined ;
45604558 }
45614559 else {
45624560 markerMap . set ( name , marker ) ;
@@ -4623,7 +4621,7 @@ function parseFileContent(content: string, fileName: string, markerMap: Map<stri
46234621 // found a range end
46244622 const rangeStart = openRanges . pop ( ) ;
46254623 if ( ! rangeStart ) {
4626- throw reportError ( fileName , line , column , "Found range end with no matching start." ) ;
4624+ reportError ( fileName , line , column , "Found range end with no matching start." ) ;
46274625 }
46284626
46294627 const range : Range = {
0 commit comments