@@ -4962,38 +4962,32 @@ module private ScriptPreprocessClosure =
4962
4962
match closureDirective with
4963
4963
| ClosedSourceFile _ as csf -> [ csf]
4964
4964
| SourceFile( filename, m, source) ->
4965
- let filename = FileSystem.GetFullPathShim( filename)
4966
- if observedSources.HaveSeen( filename) then []
4967
- else
4968
- observedSources.SetSeen( filename)
4969
-
4970
- let errors = ref []
4971
- let warnings = ref []
4972
- let errorLogger =
4973
- { new ErrorLogger( " FindClosure" ) with
4974
- member x.ErrorSinkImpl ( e ) = errors := e :: ! errors
4975
- member x.WarnSinkImpl ( e ) = warnings := e :: ! warnings
4976
- member x.ErrorCount = (! errors). Length }
4977
-
4978
- use unwindEL = PushErrorLoggerPhaseUntilUnwind ( fun _ -> errorLogger)
4979
- let pathOfMetaCommandSource = Path.GetDirectoryName( filename)
4980
- match ParseScriptText( filename, source,! tcConfig, codeContext, lexResourceManager, errorLogger) with
4981
- | Some( input) ->
4982
- let tcConfigResult , noWarns = ApplyMetaCommandsFromInputToTcConfigAndGatherNoWarn ! tcConfig ( input, pathOfMetaCommandSource)
4983
- tcConfig := tcConfigResult
4965
+ let errors = ref []
4966
+ let warnings = ref []
4967
+ let errorLogger =
4968
+ { new ErrorLogger( " FindClosure" ) with
4969
+ member x.ErrorSinkImpl ( e ) = errors := e :: ! errors
4970
+ member x.WarnSinkImpl ( e ) = warnings := e :: ! warnings
4971
+ member x.ErrorCount = (! errors). Length }
4972
+
4973
+ use unwindEL = PushErrorLoggerPhaseUntilUnwind ( fun _ -> errorLogger)
4974
+ let pathOfMetaCommandSource = Path.GetDirectoryName( filename)
4975
+ match ParseScriptText( filename, source,! tcConfig, codeContext, lexResourceManager, errorLogger) with
4976
+ | Some( input) ->
4977
+ let tcConfigResult , noWarns = ApplyMetaCommandsFromInputToTcConfigAndGatherNoWarn ! tcConfig ( input, pathOfMetaCommandSource)
4978
+ tcConfig := tcConfigResult
4984
4979
4985
- let AddFileIfNotSeen ( m , filename ) =
4986
- if observedSources.HaveSeen( filename) then []
4987
- else
4988
- if IsScript( filename) then SourceFileOfFilename( filename, m, tcConfigResult.inputCodePage)
4989
- else
4990
- observedSources.SetSeen( filename)
4991
- [ ClosedSourceFile( filename, m, None,[],[],[])] // Don't traverse into .fs leafs.
4980
+ let AddFileIfNotSeen ( m , filename ) =
4981
+ if observedSources.HaveSeen( filename) then []
4982
+ else
4983
+ observedSources.SetSeen( filename)
4984
+ if IsScript( filename) then SourceFileOfFilename( filename, m, tcConfigResult.inputCodePage)
4985
+ else [ ClosedSourceFile( filename, m, None,[],[],[])] // Don't traverse into .fs leafs.
4992
4986
4993
- let loadedSources = (! tcConfig) .GetAvailableLoadedSources() |> List.rev |> List.map AddFileIfNotSeen |> List.concat
4994
- ( loadedSources |> List.map FindClosure |> List.concat)
4995
- @ [ ClosedSourceFile( filename, m, Some( input),! errors,! warnings,! noWarns)]
4996
- | None -> [ ClosedSourceFile( filename, m, None,! errors,! warnings,[])]
4987
+ let loadedSources = (! tcConfig) .GetAvailableLoadedSources() |> List.map AddFileIfNotSeen |> List.concat
4988
+ ( loadedSources |> List.map FindClosure |> List.concat)
4989
+ @ [ ClosedSourceFile( filename, m, Some( input),! errors,! warnings,! noWarns)]
4990
+ | None -> [ ClosedSourceFile( filename, m, None,! errors,! warnings,[])]
4997
4991
4998
4992
closureDirectives |> List.map FindClosure |> List.concat, ! tcConfig
4999
4993
@@ -5011,7 +5005,7 @@ module private ScriptPreprocessClosure =
5011
5005
let sourceFiles = ref []
5012
5006
let sourceInputs = ref []
5013
5007
let globalNoWarns = ref []
5014
- for directive in closureDirectives do
5008
+ for directive in List.rev closureDirectives do
5015
5009
match directive with
5016
5010
| ClosedSourceFile( filename, m, input,_,_, noWarns) ->
5017
5011
let filename = FileSystem.GetFullPathShim( filename)
@@ -5054,8 +5048,8 @@ module private ScriptPreprocessClosure =
5054
5048
let rootWarnings = rootWarnings |> List.filter isRootRange
5055
5049
5056
5050
let result : LoadClosure =
5057
- { SourceFiles = List.groupByFirst ! sourceFiles |> List.rev
5058
- References = List.groupByFirst references |> List.rev
5051
+ { SourceFiles = List.groupByFirst ! sourceFiles
5052
+ References = List.groupByFirst references
5059
5053
UnresolvedReferences = unresolvedReferences
5060
5054
Inputs = ! sourceInputs
5061
5055
NoWarns = List.groupByFirst ! globalNoWarns
0 commit comments