@@ -2479,7 +2479,7 @@ type AssemblyResolution =
24792479 resolvedPath: string
24802480 prepareToolTip: unit -> string
24812481 sysdir: bool
2482- ilAssemblyRef: ILAssemblyRef option ref
2482+ mutable ilAssemblyRef: ILAssemblyRef option
24832483 }
24842484 override this.ToString () = sprintf " %s%s " ( if this.sysdir then " [sys]" else " " ) this.resolvedPath
24852485
@@ -2494,7 +2494,7 @@ type AssemblyResolution =
24942494 //
24952495 member this.GetILAssemblyRef ( ctok , reduceMemoryUsage , tryGetMetadataSnapshot ) =
24962496 cancellable {
2497- match ! this.ilAssemblyRef with
2497+ match this.ilAssemblyRef with
24982498 | Some assemblyRef -> return assemblyRef
24992499 | None ->
25002500 let! assemblyRefOpt =
@@ -2522,7 +2522,7 @@ type AssemblyResolution =
25222522 tryGetMetadataSnapshot = tryGetMetadataSnapshot }
25232523 use reader = OpenILModuleReader this.resolvedPath readerSettings
25242524 mkRefToILAssembly reader.ILModuleDef.ManifestOfAssembly
2525- this.ilAssemblyRef := Some assemblyRef
2525+ this.ilAssemblyRef <- Some assemblyRef
25262526 return assemblyRef
25272527 }
25282528
@@ -2892,7 +2892,7 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) =
28922892 resolvedPath = resolved
28932893 prepareToolTip = ( fun () -> resolved)
28942894 sysdir = sysdir
2895- ilAssemblyRef = ref None }
2895+ ilAssemblyRef = None }
28962896 | None ->
28972897
28982898 if String.Compare( ext, " .dll" , StringComparison.OrdinalIgnoreCase)= 0
@@ -2927,7 +2927,7 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) =
29272927 let line ( append : string ) = append.Trim([| ' ' |])+ " \n "
29282928 line resolved + line fusionName)
29292929 sysdir = sysdir
2930- ilAssemblyRef = ref None }
2930+ ilAssemblyRef = None }
29312931 | None -> None
29322932 else None
29332933
@@ -3057,7 +3057,7 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) =
30573057 resolvedPath= canonicalItemSpec
30583058 prepareToolTip = ( fun () -> resolvedFile.prepareToolTip ( originalReference.Text, canonicalItemSpec))
30593059 sysdir= tcConfig.IsSystemAssembly canonicalItemSpec
3060- ilAssemblyRef = ref None })
3060+ ilAssemblyRef = None })
30613061 ( maxIndexOfReference, assemblyResolutions))
30623062
30633063 // When calculating the resulting resolutions, we're going to use the index of the reference
@@ -3395,7 +3395,7 @@ let ParseOneInputLexbuf (tcConfig: TcConfig, lexResourceManager, conditionalComp
33953395 try
33963396 let skip = true in (* don't report whitespace from lexer *)
33973397 let lightSyntaxStatus = LightSyntaxStatus ( tcConfig.ComputeLightSyntaxInitialStatus filename, true )
3398- let lexargs = mkLexargs ( filename, conditionalCompilationDefines@ tcConfig.conditionalCompilationDefines, lightSyntaxStatus, lexResourceManager, ref [], errorLogger, tcConfig.pathMap)
3398+ let lexargs = mkLexargs ( filename, conditionalCompilationDefines@ tcConfig.conditionalCompilationDefines, lightSyntaxStatus, lexResourceManager, [], errorLogger, tcConfig.pathMap)
33993399 let shortFilename = SanitizeFileName filename tcConfig.implicitIncludeDir
34003400 let input =
34013401 Lexhelp.usingLexbufForParsing ( lexbuf, filename) ( fun lexbuf ->
@@ -3525,24 +3525,24 @@ type TcAssemblyResolutions(tcConfig: TcConfig, results: AssemblyResolution list,
35253525 let frameworkDLLs , nonFrameworkReferences = resolutions.GetAssemblyResolutions() |> List.partition ( fun r -> r.sysdir)
35263526 let unresolved = resolutions.GetUnresolvedReferences()
35273527#if DEBUG
3528- let itFailed = ref false
3528+ let mutable itFailed = false
35293529 let addedText = " \n If you want to debug this right now, attach a debugger, and put a breakpoint in 'CompileOps.fs' near the text '!itFailed', and you can re-step through the assembly resolution logic."
35303530 unresolved
35313531 |> List.iter ( fun ( UnresolvedAssemblyReference ( referenceText , _ranges )) ->
35323532 if referenceText.Contains( " mscorlib" ) then
35333533 System.Diagnostics.Debug.Assert( false , sprintf " whoops, did not resolve mscorlib: '%s '%s " referenceText addedText)
3534- itFailed := true )
3534+ itFailed <- true )
35353535 frameworkDLLs
35363536 |> List.iter ( fun x ->
35373537 if not ( FileSystem.IsPathRootedShim( x.resolvedPath)) then
35383538 System.Diagnostics.Debug.Assert( false , sprintf " frameworkDLL should be absolute path: '%s '%s " x.resolvedPath addedText)
3539- itFailed := true )
3539+ itFailed <- true )
35403540 nonFrameworkReferences
35413541 |> List.iter ( fun x ->
35423542 if not ( FileSystem.IsPathRootedShim( x.resolvedPath)) then
35433543 System.Diagnostics.Debug.Assert( false , sprintf " nonFrameworkReference should be absolute path: '%s '%s " x.resolvedPath addedText)
3544- itFailed := true )
3545- if ! itFailed then
3544+ itFailed <- true )
3545+ if itFailed then
35463546 // idea is, put a breakpoint here and then step through
35473547 let assemblyList = TcAssemblyResolutions.GetAllDllReferences tcConfig
35483548 let resolutions = TcAssemblyResolutions.ResolveAssemblyReferences ( ctok, tcConfig, assemblyList, [])
@@ -4207,9 +4207,9 @@ and [<Sealed>] TcImports(tcConfigP: TcConfigProvider, initialResolutions: TcAsse
42074207 let systemRuntimeContainsType =
42084208 // NOTE: do not touch this, edit: but we did, we had no choice - TPs cannot hold a strong reference on TcImports "ever".
42094209 let tcImports = tcImportsWeak
4210- let systemRuntimeContainsTypeRef = ref ( fun typeName -> tcImports.SystemRuntimeContainsType typeName)
4211- tcImportsStrong.AttachDisposeTypeProviderAction( fun () -> systemRuntimeContainsTypeRef := ( fun _ -> raise ( System.ObjectDisposedException( " The type provider has been disposed" ))))
4212- fun arg -> systemRuntimeContainsTypeRef.Value arg
4210+ let mutable systemRuntimeContainsTypeRef = fun typeName -> tcImports.SystemRuntimeContainsType typeName
4211+ tcImportsStrong.AttachDisposeTypeProviderAction( fun () -> systemRuntimeContainsTypeRef <- fun _ -> raise ( System.ObjectDisposedException( " The type provider has been disposed" )))
4212+ fun arg -> systemRuntimeContainsTypeRef arg
42134213
42144214 let providers =
42154215 [ for designTimeAssemblyName in designTimeAssemblyNames do
@@ -4676,7 +4676,7 @@ and [<Sealed>] TcImports(tcConfigP: TcConfigProvider, initialResolutions: TcAsse
46764676 error( InternalError( " BuildFrameworkTcImports: no successful import of " + coreLibraryResolution.resolvedPath, coreLibraryResolution.originalReference.Range))
46774677 | None ->
46784678 error( InternalError( sprintf " BuildFrameworkTcImports: no resolution of '%s '" coreLibraryReference.Text, rangeStartup))
4679- IlxSettings.ilxFsharpCoreLibAssemRef :=
4679+ IlxSettings.ilxFsharpCoreLibAssemRef <-
46804680 ( let scoref = fslibCcuInfo.ILScopeRef
46814681 match scoref with
46824682 | ILScopeRef.Assembly aref -> Some aref
@@ -4691,11 +4691,11 @@ and [<Sealed>] TcImports(tcConfigP: TcConfigProvider, initialResolutions: TcAsse
46914691
46924692#if DEBUG
46934693 // the global_g reference cell is used only for debug printing
4694- global_g := Some tcGlobals
4694+ global_ g <- Some tcGlobals
46954695#endif
46964696 // do this prior to parsing, since parsing IL assembly code may refer to mscorlib
46974697#if ! NO_ INLINE_ IL_ PARSER
4698- FSharp.Compiler.AbstractIL.Internal.AsciiConstants.parseILGlobals := tcGlobals .ilg
4698+ FSharp.Compiler.AbstractIL.Internal.AsciiConstants.parseILGlobals <- tcGlobals.ilg
46994699#endif
47004700 frameworkTcImports.SetTcGlobals tcGlobals
47014701 return tcGlobals, frameworkTcImports
@@ -5035,8 +5035,8 @@ module private ScriptPreprocessClosure =
50355035 ( tcConfig : TcConfig , inp : ParsedInput , pathOfMetaCommandSource ) =
50365036
50375037 let tcConfigB = tcConfig.CloneOfOriginalBuilder
5038- let nowarns = ref []
5039- let getWarningNumber = fun () ( m , s ) -> nowarns := ( s, m) :: ! nowarns
5038+ let mutable nowarns = []
5039+ let getWarningNumber = fun () ( m , s ) -> nowarns <- ( s, m) :: nowarns
50405040 let addReferencedAssemblyByPath = fun () ( m , s ) -> tcConfigB.AddReferencedAssemblyByPath( m, s)
50415041 let addLoadedSource = fun () ( m , s ) -> tcConfigB.AddLoadedSource( m, s, pathOfMetaCommandSource)
50425042 try
@@ -5056,7 +5056,7 @@ module private ScriptPreprocessClosure =
50565056 ( closureSources , tcConfig : TcConfig , codeContext ,
50575057 lexResourceManager : Lexhelp.LexResourceManager ) =
50585058
5059- let tcConfig = ref tcConfig
5059+ let mutable tcConfig = tcConfig
50605060
50615061 let observedSources = Observed()
50625062 let rec loop ( ClosureSource ( filename , m , sourceText , parseRequired )) =
@@ -5067,20 +5067,20 @@ module private ScriptPreprocessClosure =
50675067 let parseResult , parseDiagnostics =
50685068 let errorLogger = CapturingErrorLogger( " FindClosureParse" )
50695069 use _unwindEL = PushErrorLoggerPhaseUntilUnwind ( fun _ -> errorLogger)
5070- let result = ParseScriptText ( filename, sourceText, ! tcConfig, codeContext, lexResourceManager, errorLogger)
5070+ let result = ParseScriptText ( filename, sourceText, tcConfig, codeContext, lexResourceManager, errorLogger)
50715071 result, errorLogger.Diagnostics
50725072
50735073 match parseResult with
50745074 | Some parsedScriptAst ->
50755075 let errorLogger = CapturingErrorLogger( " FindClosureMetaCommands" )
50765076 use _unwindEL = PushErrorLoggerPhaseUntilUnwind ( fun _ -> errorLogger)
50775077 let pathOfMetaCommandSource = Path.GetDirectoryName filename
5078- let preSources = (! tcConfig) .GetAvailableLoadedSources()
5078+ let preSources = tcConfig.GetAvailableLoadedSources()
50795079
5080- let tcConfigResult , noWarns = ApplyMetaCommandsFromInputToTcConfigAndGatherNoWarn (! tcConfig, parsedScriptAst, pathOfMetaCommandSource)
5081- tcConfig := tcConfigResult // We accumulate the tcConfig in order to collect assembly references
5080+ let tcConfigResult , noWarns = ApplyMetaCommandsFromInputToTcConfigAndGatherNoWarn ( tcConfig, parsedScriptAst, pathOfMetaCommandSource)
5081+ tcConfig <- tcConfigResult // We accumulate the tcConfig in order to collect assembly references
50825082
5083- let postSources = (! tcConfig) .GetAvailableLoadedSources()
5083+ let postSources = tcConfig.GetAvailableLoadedSources()
50845084 let sources = if preSources.Length < postSources.Length then postSources.[ preSources.Length..] else []
50855085
50865086 //for (_, subFile) in sources do
@@ -5094,7 +5094,7 @@ module private ScriptPreprocessClosure =
50945094 yield ClosureFile( subFile, m, None, [], [], [])
50955095
50965096 //printfn "yielding source %s" filename
5097- yield ClosureFile( filename, m, Some parsedScriptAst, parseDiagnostics, errorLogger.Diagnostics, ! noWarns)
5097+ yield ClosureFile( filename, m, Some parsedScriptAst, parseDiagnostics, errorLogger.Diagnostics, noWarns)
50985098
50995099 | None ->
51005100 //printfn "yielding source %s (failed parse)" filename
@@ -5104,7 +5104,7 @@ module private ScriptPreprocessClosure =
51045104 //printfn "yielding non-script source %s" filename
51055105 yield ClosureFile( filename, m, None, [], [], []) ]
51065106
5107- closureSources |> List.collect loop, ! tcConfig
5107+ closureSources |> List.collect loop, tcConfig
51085108
51095109 /// Reduce the full directive closure into LoadClosure
51105110 let GetLoadClosure ( ctok , rootFilename , closureFiles , tcConfig : TcConfig , codeContext ) =
0 commit comments