@@ -4976,38 +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- ( loadedSources |> List.map FindClosure |> List.concat)
5009- @ [ ClosedSourceFile( filename, m, Some( input),! errors,! warnings,! noWarns)]
5010- | 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,[])]
50115005
50125006 closureDirectives |> List.map FindClosure |> List.concat, ! tcConfig
50135007
@@ -5025,7 +5019,7 @@ module private ScriptPreprocessClosure =
50255019 let sourceFiles = ref []
50265020 let sourceInputs = ref []
50275021 let globalNoWarns = ref []
5028- for directive in closureDirectives do
5022+ for directive in List.rev closureDirectives do
50295023 match directive with
50305024 | ClosedSourceFile( filename, m, input,_,_, noWarns) ->
50315025 let filename = FileSystem.GetFullPathShim( filename)
@@ -5068,8 +5062,8 @@ module private ScriptPreprocessClosure =
50685062 let rootWarnings = rootWarnings |> List.filter isRootRange
50695063
50705064 let result : LoadClosure =
5071- { SourceFiles = List.groupByFirst ! sourceFiles |> List.rev
5072- References = List.groupByFirst references |> List.rev
5065+ { SourceFiles = List.groupByFirst ! sourceFiles
5066+ References = List.groupByFirst references
50735067 UnresolvedReferences = unresolvedReferences
50745068 Inputs = ! sourceInputs
50755069 NoWarns = List.groupByFirst ! globalNoWarns
0 commit comments