Skip to content

Commit e556508

Browse files
cartermpKevinRansom
authored andcommitted
Remove IVT to fsi from FSharp.Compiler.Private (#6957)
* Remove IVT to fsi from FSharp.Compiler.Private * Save the out stream * Remove IVT to fsianycpu
1 parent 8e0565f commit e556508

5 files changed

Lines changed: 15 additions & 17 deletions

File tree

src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@
4040

4141
<ItemGroup>
4242
<InternalsVisibleTo Include="fsc" />
43-
<InternalsVisibleTo Include="fsi" />
44-
<InternalsVisibleTo Include="fsiAnyCpu" />
4543
<InternalsVisibleTo Include="FSharp.LanguageService" />
4644
<InternalsVisibleTo Include="FSharp.LanguageService.Base" />
4745
<InternalsVisibleTo Include="FSharp.ProjectSystem.Base" />

src/fsharp/fsc.fs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2176,7 +2176,13 @@ let typecheckAndCompile
21762176
defaultCopyFSharpCore, exiter: Exiter, errorLoggerProvider, tcImportsCapture, dynamicAssemblyCreator) =
21772177

21782178
use d = new DisposablesTracker()
2179-
use e = new SaveAndRestoreConsoleEncoding()
2179+
let savedOut = System.Console.Out
2180+
use __ =
2181+
{ new IDisposable with
2182+
member __.Dispose() =
2183+
try
2184+
System.Console.SetOut(savedOut)
2185+
with _ -> ()}
21802186

21812187
main0(ctok, argv, legacyReferenceResolver, bannerAlreadyPrinted, reduceMemoryUsage, defaultCopyFSharpCore, exiter, errorLoggerProvider, d)
21822188
|> main1

src/fsharp/fsi/console.fs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ namespace FSharp.Compiler.Interactive
55
open System
66
open System.Text
77
open System.Collections.Generic
8-
open Internal.Utilities
98

109
/// System.Console.ReadKey appears to return an ANSI character (not the expected the unicode character).
1110
/// When this fix flag is true, this byte is converted to a char using the System.Console.InputEncoding.

src/fsharp/fsi/fsimain.fs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,8 @@ open System.Windows.Forms
2222
#endif
2323

2424
open FSharp.Compiler
25-
open FSharp.Compiler.AbstractIL
26-
open FSharp.Compiler.Lib
25+
open FSharp.Compiler.AbstractIL
2726
open FSharp.Compiler.Interactive.Shell
28-
open FSharp.Compiler.Interactive
2927
open FSharp.Compiler.Interactive.Shell.Settings
3028

3129
#nowarn "55"
@@ -316,7 +314,13 @@ let evaluateSession(argv: string[]) =
316314
let MainMain argv =
317315
ignore argv
318316
let argv = System.Environment.GetCommandLineArgs()
319-
use e = new SaveAndRestoreConsoleEncoding()
317+
let savedOut = Console.Out
318+
use __ =
319+
{ new IDisposable with
320+
member __.Dispose() =
321+
try
322+
Console.SetOut(savedOut)
323+
with _ -> ()}
320324

321325
#if !FX_NO_APP_DOMAINS
322326
let timesFlag = argv |> Array.exists (fun x -> x = "/times" || x = "--times")

src/fsharp/lib.fs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,6 @@ let GetEnvInteger e dflt = match System.Environment.GetEnvironmentVariable(e) wi
2323

2424
let dispose (x:System.IDisposable) = match x with null -> () | x -> x.Dispose()
2525

26-
type SaveAndRestoreConsoleEncoding () =
27-
let savedOut = System.Console.Out
28-
29-
interface System.IDisposable with
30-
member this.Dispose() =
31-
try
32-
System.Console.SetOut(savedOut)
33-
with _ -> ()
34-
3526
//-------------------------------------------------------------------------
3627
// Library: bits
3728
//------------------------------------------------------------------------

0 commit comments

Comments
 (0)