1818/// <reference path="harnessLanguageService.ts" />
1919/// <reference path="harness.ts" />
2020/// <reference path="fourslashRunner.ts" />
21- /* tslint:disable:no-null-keyword */
2221
2322namespace FourSlash {
2423 ts . disableIncrementalParsing = false ;
@@ -198,7 +197,7 @@ namespace FourSlash {
198197 public lastKnownMarker : string = "" ;
199198
200199 // The file that's currently 'opened'
201- public activeFile : FourSlashFile = null ;
200+ public activeFile : FourSlashFile ;
202201
203202 // Whether or not we should format on keystrokes
204203 public enableFormatting = true ;
@@ -922,7 +921,7 @@ namespace FourSlash {
922921
923922 public verifyCurrentParameterIsletiable ( isVariable : boolean ) {
924923 const signature = this . getActiveSignatureHelpItem ( ) ;
925- assert . isNotNull ( signature ) ;
924+ assert . isOk ( signature ) ;
926925 assert . equal ( isVariable , signature . isVariadic ) ;
927926 }
928927
@@ -1911,7 +1910,7 @@ namespace FourSlash {
19111910 public verifyNavigationItemsCount ( expected : number , searchValue : string , matchKind ?: string ) {
19121911 const items = this . languageService . getNavigateToItems ( searchValue ) ;
19131912 let actual = 0 ;
1914- let item : ts . NavigateToItem = null ;
1913+ let item : ts . NavigateToItem ;
19151914
19161915 // Count only the match that match the same MatchKind
19171916 for ( let i = 0 ; i < items . length ; i ++ ) {
@@ -2183,7 +2182,7 @@ namespace FourSlash {
21832182 }
21842183
21852184 private findFile ( indexOrName : any ) {
2186- let result : FourSlashFile = null ;
2185+ let result : FourSlashFile ;
21872186 if ( typeof indexOrName === "number" ) {
21882187 const index = < number > indexOrName ;
21892188 if ( index >= this . testData . files . length ) {
@@ -2352,9 +2351,15 @@ ${code}
23522351 const ranges : Range [ ] = [ ] ;
23532352
23542353 // Stuff related to the subfile we're parsing
2355- let currentFileContent : string = null ;
2354+ let currentFileContent : string = undefined ;
23562355 let currentFileName = fileName ;
23572356 let currentFileOptions : { [ s : string ] : string } = { } ;
2357+
2358+ function resetLocalData ( ) {
2359+ currentFileContent = undefined ;
2360+ currentFileOptions = { } ;
2361+ currentFileName = fileName ;
2362+ }
23582363
23592364 for ( let i = 0 ; i < lines . length ; i ++ ) {
23602365 let line = lines [ i ] ;
@@ -2368,7 +2373,7 @@ ${code}
23682373 // Subfile content line
23692374
23702375 // Append to the current subfile content, inserting a newline needed
2371- if ( currentFileContent === null ) {
2376+ if ( currentFileContent === undefined ) {
23722377 currentFileContent = "" ;
23732378 }
23742379 else {
@@ -2400,10 +2405,7 @@ ${code}
24002405 // Store result file
24012406 files . push ( file ) ;
24022407
2403- // Reset local data
2404- currentFileContent = null ;
2405- currentFileOptions = { } ;
2406- currentFileName = fileName ;
2408+ resetLocalData ( ) ;
24072409 }
24082410
24092411 currentFileName = basePath + "/" + match [ 2 ] ;
@@ -2430,10 +2432,7 @@ ${code}
24302432 // Store result file
24312433 files . push ( file ) ;
24322434
2433- // Reset local data
2434- currentFileContent = null ;
2435- currentFileOptions = { } ;
2436- currentFileName = fileName ;
2435+ resetLocalData ( ) ;
24372436 }
24382437 }
24392438 }
@@ -2498,7 +2497,7 @@ ${code}
24982497
24992498 if ( markerValue === undefined ) {
25002499 reportError ( fileName , location . sourceLine , location . sourceColumn , "Object markers can not be empty" ) ;
2501- return null ;
2500+ return undefined ;
25022501 }
25032502
25042503 const marker : Marker = {
@@ -2527,7 +2526,7 @@ ${code}
25272526 if ( markerMap [ name ] !== undefined ) {
25282527 const message = "Marker '" + name + "' is duplicated in the source file contents." ;
25292528 reportError ( marker . fileName , location . sourceLine , location . sourceColumn , message ) ;
2530- return null ;
2529+ return undefined ;
25312530 }
25322531 else {
25332532 markerMap [ name ] = marker ;
@@ -2546,7 +2545,7 @@ ${code}
25462545 let output = "" ;
25472546
25482547 /// The current marker (or maybe multi-line comment?) we're parsing, possibly
2549- let openMarker : LocationInformation = null ;
2548+ let openMarker : LocationInformation = undefined ;
25502549
25512550 /// A stack of the open range markers that are still unclosed
25522551 const openRanges : RangeLocationInformation [ ] = [ ] ;
@@ -2654,7 +2653,7 @@ ${code}
26542653 difference += i + 1 - openMarker . sourcePosition ;
26552654
26562655 // Reset the state
2657- openMarker = null ;
2656+ openMarker = undefined ;
26582657 state = State . none ;
26592658 }
26602659 break ;
@@ -2676,7 +2675,7 @@ ${code}
26762675 difference += i + 1 - openMarker . sourcePosition ;
26772676
26782677 // Reset the state
2679- openMarker = null ;
2678+ openMarker = undefined ;
26802679 state = State . none ;
26812680 }
26822681 else if ( validMarkerChars . indexOf ( currentChar ) < 0 ) {
@@ -2688,7 +2687,7 @@ ${code}
26882687 // Bail out the text we've gathered so far back into the output
26892688 flush ( i ) ;
26902689 lastNormalCharPosition = i ;
2691- openMarker = null ;
2690+ openMarker = undefined ;
26922691
26932692 state = State . none ;
26942693 }
@@ -2719,7 +2718,7 @@ ${code}
27192718 reportError ( fileName , openRange . sourceLine , openRange . sourceColumn , "Unterminated range." ) ;
27202719 }
27212720
2722- if ( openMarker !== null ) {
2721+ if ( openMarker ) {
27232722 reportError ( fileName , openMarker . sourceLine , openMarker . sourceColumn , "Unterminated marker." ) ;
27242723 }
27252724
0 commit comments