Skip to content

Commit 6c1ffbb

Browse files
committed
cleanup
1 parent f97dcf6 commit 6c1ffbb

File tree

8 files changed

+28
-40
lines changed

8 files changed

+28
-40
lines changed

src/absil/il.fsi

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2092,9 +2092,7 @@ type ILPropertyRef =
20922092
member Name: string
20932093
interface System.IComparable
20942094

2095-
#if ENABLE_MONO_SUPPORT
20962095
val runningOnMono: bool
2097-
#endif
20982096

20992097
type ILReferences =
21002098
{ AssemblyReferences: ILAssemblyRef list;

src/absil/ilread.fs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3807,11 +3807,9 @@ let rec genOpenBinaryReader infile is opts =
38073807
let pdb = None
38083808
#else
38093809
let pdb =
3810-
#if ENABLE_MONO_SUPPORT
38113810
if runningOnMono then
38123811
None
38133812
else
3814-
#endif
38153813
getPdbReader opts infile
38163814
#endif
38173815

src/fsharp/CompileOps.fs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1579,9 +1579,9 @@ let OutputErrorOrWarningContext prefix fileLineFn os err =
15791579
let GetFSharpCoreLibraryName () = "FSharp.Core"
15801580

15811581
type internal TypeInThisAssembly = class end
1582-
let GetFSharpCoreReferenceUsedByCompiler(useMonoResolution) =
1582+
let GetFSharpCoreReferenceUsedByCompiler(useSimpleResolution) =
15831583
// On Mono, there is no good reference resolution
1584-
if useMonoResolution then
1584+
if useSimpleResolution then
15851585
GetFSharpCoreLibraryName()+".dll"
15861586
else
15871587
let fsCoreName = GetFSharpCoreLibraryName()
@@ -1698,8 +1698,8 @@ let SystemAssemblies primaryAssemblyName =
16981698
//
16991699
// REVIEW: it isn't clear if there is any negative effect
17001700
// of leaving an assembly off this list.
1701-
let BasicReferencesForScriptLoadClosure(useMonoResolution, useFsiAuxLib) =
1702-
["mscorlib"; GetFSharpCoreReferenceUsedByCompiler(useMonoResolution) ] @ // Need to resolve these explicitly so they will be found in the reference assemblies directory which is where the .xml files are.
1701+
let BasicReferencesForScriptLoadClosure(useSimpleResolution, useFsiAuxLib) =
1702+
["mscorlib"; GetFSharpCoreReferenceUsedByCompiler(useSimpleResolution) ] @ // Need to resolve these explicitly so they will be found in the reference assemblies directory which is where the .xml files are.
17031703
DefaultBasicReferencesForOutOfProjectSources @
17041704
[ if useFsiAuxLib then yield GetFsiLibraryName () ]
17051705

@@ -2011,7 +2011,7 @@ type TcConfigBuilder =
20112011
mutable resolutionAssemblyFoldersConditions : string;
20122012
mutable platform : ILPlatform option;
20132013
mutable prefer32Bit : bool;
2014-
mutable useMonoResolution : bool
2014+
mutable useSimpleResolution : bool
20152015
mutable target : CompilerTarget
20162016
mutable debuginfo : bool
20172017
mutable testFlagEmitFeeFeeAs100001 : bool;
@@ -2177,9 +2177,9 @@ type TcConfigBuilder =
21772177
platform = None;
21782178
prefer32Bit = false;
21792179
#if ENABLE_MONO_SUPPORT
2180-
useMonoResolution = runningOnMono
2180+
useSimpleResolution = runningOnMono
21812181
#else
2182-
useMonoResolution = false
2182+
useSimpleResolution = false
21832183
#endif
21842184
target = ConsoleExe
21852185
debuginfo = false
@@ -2531,7 +2531,7 @@ type TcConfig private (data : TcConfigBuilder,validate:bool) =
25312531
match fileNameOpt with
25322532
| None ->
25332533
// if FSharp.Core was not provided explicitly - use version that was referenced by compiler
2534-
AssemblyReference(range0, GetFSharpCoreReferenceUsedByCompiler(data.useMonoResolution), None), None
2534+
AssemblyReference(range0, GetFSharpCoreReferenceUsedByCompiler(data.useSimpleResolution), None), None
25352535
| _ -> res
25362536
let primaryAssemblyCcuInitializer = getSystemRuntimeInitializer data.primaryAssembly (computeKnownDllReference >> fst)
25372537

@@ -2667,7 +2667,7 @@ type TcConfig private (data : TcConfigBuilder,validate:bool) =
26672667
member x.resolutionAssemblyFoldersConditions = data. resolutionAssemblyFoldersConditions
26682668
member x.platform = data.platform
26692669
member x.prefer32Bit = data.prefer32Bit
2670-
member x.useMonoResolution = data.useMonoResolution
2670+
member x.useSimpleResolution = data.useSimpleResolution
26712671
member x.target = data.target
26722672
member x.debuginfo = data.debuginfo
26732673
member x.testFlagEmitFeeFeeAs100001 = data.testFlagEmitFeeFeeAs100001
@@ -2942,7 +2942,7 @@ type TcConfig private (data : TcConfigBuilder,validate:bool) =
29422942
// NOTE!! if mode=ReportErrors then this method must not raise exceptions. It must just report the errors and recover
29432943
static member TryResolveLibsUsingMSBuildRules (tcConfig:TcConfig,originalReferences:AssemblyReference list, errorAndWarningRange:range, mode:ResolveAssemblyReferenceMode) : AssemblyResolution list * UnresolvedAssemblyReference list =
29442944
use unwindBuildPhase = PushThreadBuildPhaseUntilUnwind (BuildPhase.Parameter)
2945-
if tcConfig.useMonoResolution then
2945+
if tcConfig.useSimpleResolution then
29462946
failwith "MSBuild resolution is not supported."
29472947
if originalReferences=[] then [],[]
29482948
else
@@ -3450,7 +3450,7 @@ type TcAssemblyResolutions(results : AssemblyResolution list, unresolved : Unres
34503450

34513451
static member Resolve (tcConfig:TcConfig,assemblyList:AssemblyReference list, knownUnresolved:UnresolvedAssemblyReference list) : TcAssemblyResolutions =
34523452
let resolved,unresolved =
3453-
if tcConfig.useMonoResolution then
3453+
if tcConfig.useSimpleResolution then
34543454
let resolutions =
34553455
assemblyList
34563456
|> List.map (fun assemblyReference ->
@@ -4449,7 +4449,7 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti
44494449
| Some assemblyResolution ->
44504450
ResultD [assemblyResolution]
44514451
| None ->
4452-
if tcConfigP.Get().useMonoResolution then
4452+
if tcConfigP.Get().useSimpleResolution then
44534453
let action =
44544454
match mode with
44554455
| ResolveAssemblyReferenceMode.ReportErrors -> CcuLoadFailureAction.RaiseError
@@ -4857,15 +4857,15 @@ module private ScriptPreprocessClosure =
48574857
ParseOneInputLexbuf (tcConfig,lexResourceManager,defines,lexbuf,filename,isLastCompiland,errorLogger)
48584858

48594859
/// Create a TcConfig for load closure starting from a single .fsx file
4860-
let CreateScriptSourceTcConfig (filename:string, codeContext, useMonoResolution, useFsiAuxLib, basicReferences, applyCommandLineArgs) =
4860+
let CreateScriptSourceTcConfig (filename:string, codeContext, useSimpleResolution, useFsiAuxLib, basicReferences, applyCommandLineArgs) =
48614861
let projectDir = Path.GetDirectoryName(filename)
48624862
let isInteractive = (codeContext = CodeContext.Evaluation)
48634863
let isInvalidationSupported = (codeContext = CodeContext.Editing)
48644864
// always use primary assembly = mscorlib for scripts
48654865
let tcConfigB = TcConfigBuilder.CreateNew(Internal.Utilities.FSharpEnvironment.BinFolderOfDefaultFSharpCompiler.Value, true (* optimize for memory *), projectDir, isInteractive, isInvalidationSupported)
48664866
applyCommandLineArgs tcConfigB
48674867
match basicReferences with
4868-
| None -> BasicReferencesForScriptLoadClosure(useMonoResolution, useFsiAuxLib) |> List.iter(fun f->tcConfigB.AddReferencedAssemblyByPath(range0,f)) // Add script references
4868+
| None -> BasicReferencesForScriptLoadClosure(useSimpleResolution, useFsiAuxLib) |> List.iter(fun f->tcConfigB.AddReferencedAssemblyByPath(range0,f)) // Add script references
48694869
| Some rs -> for m,r in rs do tcConfigB.AddReferencedAssemblyByPath(m,r)
48704870

48714871
tcConfigB.resolutionEnvironment <-
@@ -5026,18 +5026,18 @@ module private ScriptPreprocessClosure =
50265026
result
50275027

50285028
/// Given source text, find the full load closure. Used from service.fs, when editing a script file
5029-
let GetFullClosureOfScriptSource(filename,source,codeContext,useMonoResolution,useFsiAuxLib,lexResourceManager:Lexhelp.LexResourceManager,applyCommmandLineArgs) =
5029+
let GetFullClosureOfScriptSource(filename,source,codeContext,useSimpleResolution,useFsiAuxLib,lexResourceManager:Lexhelp.LexResourceManager,applyCommmandLineArgs) =
50305030
// Resolve the basic references such as FSharp.Core.dll first, before processing any #I directives in the script
50315031
//
50325032
// This is tries to mimic the action of running the script in F# Interactive - the initial context for scripting is created
50335033
// first, then #I and other directives are processed.
50345034
let references0 =
5035-
let tcConfig = CreateScriptSourceTcConfig(filename,codeContext,useMonoResolution,useFsiAuxLib,None,applyCommmandLineArgs)
5035+
let tcConfig = CreateScriptSourceTcConfig(filename,codeContext,useSimpleResolution,useFsiAuxLib,None,applyCommmandLineArgs)
50365036
let resolutions0,_unresolvedReferences = GetAssemblyResolutionInformation(tcConfig)
50375037
let references0 = resolutions0 |> List.map (fun r->r.originalReference.Range,r.resolvedPath) |> Seq.distinct |> List.ofSeq
50385038
references0
50395039

5040-
let tcConfig = CreateScriptSourceTcConfig(filename,codeContext,useMonoResolution,useFsiAuxLib,Some references0,applyCommmandLineArgs)
5040+
let tcConfig = CreateScriptSourceTcConfig(filename,codeContext,useSimpleResolution,useFsiAuxLib,Some references0,applyCommmandLineArgs)
50415041

50425042
let protoClosure = [SourceFile(filename,range0,source)]
50435043
let finalClosure,tcConfig = FindClosureDirectives(protoClosure,tcConfig,codeContext,lexResourceManager)
@@ -5053,9 +5053,9 @@ module private ScriptPreprocessClosure =
50535053

50545054
type LoadClosure with
50555055
// Used from service.fs, when editing a script file
5056-
static member ComputeClosureOfSourceText(filename:string, source:string, codeContext, useMonoResolution:bool, useFsiAuxLib, lexResourceManager:Lexhelp.LexResourceManager, applyCommmandLineArgs) : LoadClosure =
5056+
static member ComputeClosureOfSourceText(filename:string, source:string, codeContext, useSimpleResolution:bool, useFsiAuxLib, lexResourceManager:Lexhelp.LexResourceManager, applyCommmandLineArgs) : LoadClosure =
50575057
use unwindBuildPhase = PushThreadBuildPhaseUntilUnwind (BuildPhase.Parse)
5058-
ScriptPreprocessClosure.GetFullClosureOfScriptSource(filename,source,codeContext,useMonoResolution,useFsiAuxLib, lexResourceManager, applyCommmandLineArgs)
5058+
ScriptPreprocessClosure.GetFullClosureOfScriptSource(filename,source,codeContext,useSimpleResolution,useFsiAuxLib, lexResourceManager, applyCommmandLineArgs)
50595059

50605060
/// Used from fsi.fs and fsc.fs, for #load and command line.
50615061
/// The resulting references are then added to a TcConfig.

src/fsharp/CompileOps.fsi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ type TcConfigBuilder =
273273
mutable resolutionAssemblyFoldersConditions : string
274274
mutable platform : ILPlatform option
275275
mutable prefer32Bit : bool
276-
mutable useMonoResolution : bool
276+
mutable useSimpleResolution : bool
277277
mutable target : CompilerTarget
278278
mutable debuginfo : bool
279279
mutable testFlagEmitFeeFeeAs100001 : bool
@@ -425,7 +425,7 @@ type TcConfig =
425425
member resolutionAssemblyFoldersConditions : string
426426
member platform : ILPlatform option
427427
member prefer32Bit : bool
428-
member useMonoResolution : bool
428+
member useSimpleResolution : bool
429429
member target : CompilerTarget
430430
member debuginfo : bool
431431
member testFlagEmitFeeFeeAs100001 : bool
@@ -775,7 +775,7 @@ type LoadClosure =
775775
RootWarnings : PhasedError list }
776776

777777
// Used from service.fs, when editing a script file
778-
static member ComputeClosureOfSourceText : filename: string * source: string * implicitDefines:CodeContext * useMonoResolution: bool * useFsiAuxLib: bool * lexResourceManager: Lexhelp.LexResourceManager * applyCompilerOptions: (TcConfigBuilder -> unit) -> LoadClosure
778+
static member ComputeClosureOfSourceText : filename: string * source: string * implicitDefines:CodeContext * useSimpleResolution: bool * useFsiAuxLib: bool * lexResourceManager: Lexhelp.LexResourceManager * applyCompilerOptions: (TcConfigBuilder -> unit) -> LoadClosure
779779

780780
/// Used from fsi.fs and fsc.fs, for #load and command line. The resulting references are then added to a TcConfig.
781781
static member ComputeClosureOfSourceFiles : tcConfig:TcConfig * (string * range) list * implicitDefines:CodeContext * useDefaultScriptingReferences : bool * lexResourceManager : Lexhelp.LexResourceManager -> LoadClosure

src/fsharp/CompileOptions.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,7 @@ let advancedFlagsFsc tcConfigB =
780780
#endif
781781
yield CompilerOption("pdb", tagString, OptionString (fun s -> tcConfigB.debugSymbolFile <- Some s), None,
782782
Some (FSComp.SR.optsPdb()));
783-
yield CompilerOption("simpleresolution", tagNone, OptionUnit (fun () -> tcConfigB.useMonoResolution<-true), None,
783+
yield CompilerOption("simpleresolution", tagNone, OptionUnit (fun () -> tcConfigB.useSimpleResolution<-true), None,
784784
Some (FSComp.SR.optsSimpleresolution()));
785785
yield CompilerOption("highentropyva", tagNone, OptionSwitch (useHighEntropyVASwitch tcConfigB), None, Some (FSComp.SR.optsUseHighEntropyVA()))
786786
yield CompilerOption("subsystemversion", tagString, OptionString (subSystemVersionSwitch tcConfigB), None, Some (FSComp.SR.optsSubSystemVersion()))
@@ -859,7 +859,7 @@ let internalFlags (tcConfigB:TcConfigBuilder) =
859859
CompilerOption("resolutionframeworkregistrybase", tagString, OptionString (fun s -> tcConfigB.resolutionFrameworkRegistryBase<-s), Some(InternalCommandLineOption("", rangeCmdArgs)), None); // "The base registry key to use for assembly resolution. This part in brackets here: HKEY_LOCAL_MACHINE\[SOFTWARE\Microsoft\.NETFramework]\v2.0.50727\AssemblyFoldersEx");
860860
CompilerOption("resolutionassemblyfoldersuffix", tagString, OptionString (fun s -> tcConfigB.resolutionAssemblyFoldersSuffix<-s), Some(InternalCommandLineOption("resolutionassemblyfoldersuffix", rangeCmdArgs)), None); // "The base registry key to use for assembly resolution. This part in brackets here: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v2.0.50727\[AssemblyFoldersEx]");
861861
CompilerOption("resolutionassemblyfoldersconditions", tagString, OptionString (fun s -> tcConfigB.resolutionAssemblyFoldersConditions <- ","^s), Some(InternalCommandLineOption("resolutionassemblyfoldersconditions", rangeCmdArgs)), None); // "Additional reference resolution conditions. For example \"OSVersion=5.1.2600.0,PlatformID=id");
862-
CompilerOption("msbuildresolution", tagNone, OptionUnit (fun () -> tcConfigB.useMonoResolution<-false), Some(InternalCommandLineOption("msbuildresolution", rangeCmdArgs)), None); // "Resolve assembly references using MSBuild resolution rules rather than directory based (Default=true except when running fsc.exe under mono)");
862+
CompilerOption("msbuildresolution", tagNone, OptionUnit (fun () -> tcConfigB.useSimpleResolution<-false), Some(InternalCommandLineOption("msbuildresolution", rangeCmdArgs)), None); // "Resolve assembly references using MSBuild resolution rules rather than directory based (Default=true except when running fsc.exe under mono)");
863863
CompilerOption("alwayscallvirt",tagNone,OptionSwitch(callVirtSwitch tcConfigB),Some(InternalCommandLineOption("alwayscallvirt",rangeCmdArgs)), None);
864864
CompilerOption("nodebugdata",tagNone, OptionUnit (fun () -> tcConfigB.noDebugData<-true),Some(InternalCommandLineOption("--nodebugdata",rangeCmdArgs)), None);
865865
testFlag tcConfigB ] @

src/fsharp/fsc.fs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,11 +1234,7 @@ module MainModuleBuilder =
12341234
yield Lazy<_>.CreateFromValue av
12351235
if not(tcConfig.win32res = "") then
12361236
yield Lazy<_>.CreateFromValue (FileSystem.ReadAllBytesShim tcConfig.win32res)
1237-
#if ENABLE_MONO_SUPPORT
1238-
if tcConfig.includewin32manifest && not(win32Manifest = "") && not(runningOnMono) then
1239-
#else
1240-
if tcConfig.includewin32manifest && not(win32Manifest = "") then
1241-
#endif
1237+
if tcConfig.includewin32manifest && not(win32Manifest = "") && not runningOnMono then
12421238
yield Lazy<_>.CreateFromValue [| yield! ResFileFormat.ResFileHeader()
12431239
yield! (ManifestResourceFormat.VS_MANIFEST_RESOURCE((FileSystem.ReadAllBytesShim win32Manifest), tcConfig.target = Dll)) |]]
12441240

src/fsharp/fsi/fsi.fs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -835,11 +835,7 @@ type internal FsiDynamicCompiler
835835
errorLogger.AbortOnError();
836836

837837
let fragName = textOfLid prefixPath
838-
#if ENABLE_MONO_SUPPORT
839838
let codegenResults = GenerateIlxCode (IlReflectBackend, isInteractiveItExpr, runningOnMono, tcConfig, topCustomAttrs, optimizedImpls, fragName, true, ilxGenerator)
840-
#else
841-
let codegenResults = GenerateIlxCode (IlReflectBackend, isInteractiveItExpr, false, tcConfig, topCustomAttrs, optimizedImpls, fragName, true, ilxGenerator)
842-
#endif
843839
errorLogger.AbortOnError();
844840

845841
// Each input is like a small separately compiled extension to a single source file.
@@ -2229,7 +2225,7 @@ type internal FsiEvaluationSession (argv:string[], inReader:TextReader, outWrite
22292225
do tcConfigB.useFsiAuxLib <- true
22302226

22312227
#if TODO_REWORK_ASSEMBLY_LOAD
2232-
do tcConfigB.useMonoResolution<-true
2228+
do tcConfigB.useSimpleResolution<-true
22332229
#else
22342230
#endif
22352231

src/fsharp/vs/service.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2463,7 +2463,7 @@ type BackgroundCompiler(projectCacheSize, keepAssemblyContents, keepAllBackgroun
24632463
let useFsiAuxLib = defaultArg useFsiAuxLib true
24642464
// Do we use a "FSharp.Core, 4.3.0.0" reference by default?
24652465
let otherFlags = defaultArg otherFlags [| |]
2466-
let useMonoResolution =
2466+
let useSimpleResolution =
24672467
#if ENABLE_MONO_SUPPORT
24682468
runningOnMono || otherFlags |> Array.exists (fun x -> x = "--simpleresolution")
24692469
#else
@@ -2474,7 +2474,7 @@ type BackgroundCompiler(projectCacheSize, keepAssemblyContents, keepAllBackgroun
24742474
let collect _name = ()
24752475
let fsiCompilerOptions = CompileOptions.GetCoreFsiCompilerOptions tcConfigB
24762476
CompileOptions.ParseCompilerOptions (collect, fsiCompilerOptions, Array.toList otherFlags)
2477-
let fas = LoadClosure.ComputeClosureOfSourceText(filename, source, CodeContext.Editing, useMonoResolution, useFsiAuxLib, new Lexhelp.LexResourceManager(), applyCompilerOptions)
2477+
let fas = LoadClosure.ComputeClosureOfSourceText(filename, source, CodeContext.Editing, useSimpleResolution, useFsiAuxLib, new Lexhelp.LexResourceManager(), applyCompilerOptions)
24782478
let otherFlags =
24792479
[| yield "--noframework"; yield "--warn:3";
24802480
yield! otherFlags

0 commit comments

Comments
 (0)