@@ -4976,37 +4976,32 @@ module private ScriptPreprocessClosure =
49764976 match closureDirective with
49774977 | ClosedSourceFile _ as csf -> [ csf]
49784978 | SourceFile( filename, m, source) ->
4979- let filename = FileSystem.GetFullPathShim( filename)
4980- if observedSources.HaveSeen( filename) then []
4981- else
4982- observedSources.SetSeen( filename)
4983-
4984- let errors = ref []
4985- let warnings = ref []
4986- let errorLogger =
4987- { new ErrorLogger( " FindClosure" ) with
4988- member x.ErrorSinkImpl ( e ) = errors := e :: ! errors
4989- member x.WarnSinkImpl ( e ) = warnings := e :: ! warnings
4990- member x.ErrorCount = (! errors). Length }
4991-
4992- use unwindEL = PushErrorLoggerPhaseUntilUnwind ( fun _ -> errorLogger)
4993- let pathOfMetaCommandSource = Path.GetDirectoryName( filename)
4994- match ParseScriptText( filename, source,! tcConfig, codeContext, lexResourceManager, errorLogger) with
4995- | Some( input) ->
4996- let tcConfigResult , noWarns = ApplyMetaCommandsFromInputToTcConfigAndGatherNoWarn ! tcConfig ( input, pathOfMetaCommandSource)
4997- tcConfig := tcConfigResult
4979+ let errors = ref []
4980+ let warnings = ref []
4981+ let errorLogger =
4982+ { new ErrorLogger( " FindClosure" ) with
4983+ member x.ErrorSinkImpl ( e ) = errors := e :: ! errors
4984+ member x.WarnSinkImpl ( e ) = warnings := e :: ! warnings
4985+ member x.ErrorCount = (! errors). Length }
4986+
4987+ use unwindEL = PushErrorLoggerPhaseUntilUnwind ( fun _ -> errorLogger)
4988+ let pathOfMetaCommandSource = Path.GetDirectoryName( filename)
4989+ match ParseScriptText( filename, source,! tcConfig, codeContext, lexResourceManager, errorLogger) with
4990+ | Some( input) ->
4991+ let tcConfigResult , noWarns = ApplyMetaCommandsFromInputToTcConfigAndGatherNoWarn ! tcConfig ( input, pathOfMetaCommandSource)
4992+ tcConfig := tcConfigResult
49984993
4999- let AddFileIfNotSeen ( m , filename ) =
5000- if observedSources.HaveSeen( filename) then []
5001- else
5002- if IsScript( filename) then SourceFileOfFilename( filename, m, tcConfigResult.inputCodePage)
5003- else
5004- observedSources.SetSeen( filename)
5005- [ ClosedSourceFile( filename, m, None,[],[],[])] // Don't traverse into .fs leafs.
4994+ let AddFileIfNotSeen ( m , filename ) =
4995+ if observedSources.HaveSeen( filename) then []
4996+ else
4997+ observedSources.SetSeen( filename)
4998+ if IsScript( filename) then SourceFileOfFilename( filename, m, tcConfigResult.inputCodePage)
4999+ else [ ClosedSourceFile( filename, m, None,[],[],[])] // Don't traverse into .fs leafs.
50065000
5007- let loadedSources = (! tcConfig) .GetAvailableLoadedSources() |> List.rev |> List.map AddFileIfNotSeen |> List.concat
5008- ClosedSourceFile( filename, m, Some( input),! errors,! warnings,! noWarns) :: loadedSources |> List.map FindClosure |> List.concat // Final closure is in reverse order. Keep the closed source at the top.
5009- | None -> [ ClosedSourceFile( filename, m, None,! errors,! warnings,[])]
5001+ let loadedSources = (! tcConfig) .GetAvailableLoadedSources() |> List.map AddFileIfNotSeen |> List.concat
5002+ ( loadedSources |> List.map FindClosure |> List.concat)
5003+ @ [ ClosedSourceFile( filename, m, Some( input),! errors,! warnings,! noWarns)]
5004+ | None -> [ ClosedSourceFile( filename, m, None,! errors,! warnings,[])]
50105005
50115006 closureDirectives |> List.map FindClosure |> List.concat, ! tcConfig
50125007
@@ -5024,7 +5019,7 @@ module private ScriptPreprocessClosure =
50245019 let sourceFiles = ref []
50255020 let sourceInputs = ref []
50265021 let globalNoWarns = ref []
5027- for directive in closureDirectives do
5022+ for directive in List.rev closureDirectives do
50285023 match directive with
50295024 | ClosedSourceFile( filename, m, input,_,_, noWarns) ->
50305025 let filename = FileSystem.GetFullPathShim( filename)
0 commit comments