Skip to content
This repository was archived by the owner on Dec 23, 2024. It is now read-only.

Commit 252cef5

Browse files
dsymenosami
authored andcommitted
cleanup old formatting code (dotnet#9964)
* cleanup old formatting code * cleanup old formatting code * cleanup old formatting code * cleanup old formatting code * cleanup old formatting code * cleanup old formatting code * cleanup old formatting code * cleanup old formatting code * cleanup old formatting code * Update sformat.fs
1 parent 4f16bfa commit 252cef5

File tree

8 files changed

+1439
-1511
lines changed

8 files changed

+1439
-1511
lines changed

src/fsharp/CompileOptions.fs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
module internal FSharp.Compiler.CompileOptions
66

77
open Internal.Utilities
8+
open Internal.Utilities.StructuredFormat
89
open System
910
open System.IO
1011
open FSharp.Compiler
@@ -1608,10 +1609,10 @@ let PrintWholeAssemblyImplementation g (tcConfig:TcConfig) outfile header expr =
16081609
let filename = outfile + ".terms"
16091610
use f = System.IO.File.CreateText (filename + "-" + string showTermFileCount + "-" + header)
16101611
showTermFileCount <- showTermFileCount + 1
1611-
Layout.outL f (Layout.squashTo 192 (DebugPrint.implFilesL g expr))
1612+
Layout.outL f (Display.squashTo 192 (DebugPrint.implFilesL g expr))
16121613
else
16131614
dprintf "\n------------------\nshowTerm: %s:\n" header
1614-
Layout.outL stderr (Layout.squashTo 192 (DebugPrint.implFilesL g expr))
1615+
Layout.outL stderr (Display.squashTo 192 (DebugPrint.implFilesL g expr))
16151616
dprintf "\n------------------\n"
16161617

16171618
//----------------------------------------------------------------------------
@@ -1706,10 +1707,10 @@ let ApplyAllOptimizations (tcConfig:TcConfig, tcGlobals, tcVal, outfile, importM
17061707
PrintWholeAssemblyImplementation tcGlobals tcConfig outfile "pass-start" implFiles
17071708
#if DEBUG
17081709
if tcConfig.showOptimizationData then
1709-
dprintf "Expression prior to optimization:\n%s\n" (Layout.showL (Layout.squashTo 192 (DebugPrint.implFilesL tcGlobals implFiles)))
1710+
dprintf "Expression prior to optimization:\n%s\n" (Layout.showL (Display.squashTo 192 (DebugPrint.implFilesL tcGlobals implFiles)))
17101711

17111712
if tcConfig.showOptimizationData then
1712-
dprintf "CCU prior to optimization:\n%s\n" (Layout.showL (Layout.squashTo 192 (DebugPrint.entityL tcGlobals ccu.Contents)))
1713+
dprintf "CCU prior to optimization:\n%s\n" (Layout.showL (Display.squashTo 192 (DebugPrint.entityL tcGlobals ccu.Contents)))
17131714
#endif
17141715

17151716
let optEnv0 = optEnv
@@ -1738,7 +1739,7 @@ let ApplyAllOptimizations (tcConfig:TcConfig, tcGlobals, tcVal, outfile, importM
17381739
let optSettings = { optSettings with abstractBigTargets = false; reportingPhase = false }
17391740
#if DEBUG
17401741
if tcConfig.showOptimizationData then
1741-
dprintf "Optimization implFileOptData:\n%s\n" (Layout.showL (Layout.squashTo 192 (Optimizer.moduleInfoL tcGlobals implFileOptData)))
1742+
dprintf "Optimization implFileOptData:\n%s\n" (Layout.showL (Display.squashTo 192 (Optimizer.moduleInfoL tcGlobals implFileOptData)))
17421743
#endif
17431744

17441745
let implFile, optEnvExtraLoop =

src/fsharp/NicePrint.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2182,9 +2182,9 @@ let layoutExnDef denv x = x |> TastDefinitionPrinting.layoutExnDefn denv
21822182

21832183
let stringOfTyparConstraints denv x = x |> PrintTypes.layoutConstraintsWithInfo denv SimplifyTypes.typeSimplificationInfo0 |> showL
21842184

2185-
let outputTycon denv infoReader ad m (* width *) os x = TastDefinitionPrinting.layoutTycon denv infoReader ad m true WordL.keywordType x (* |> Layout.squashTo width *) |> bufferL os
2185+
let outputTycon denv infoReader ad m (* width *) os x = TastDefinitionPrinting.layoutTycon denv infoReader ad m true WordL.keywordType x (* |> Display.squashTo width *) |> bufferL os
21862186

2187-
let layoutTycon denv infoReader ad m (* width *) x = TastDefinitionPrinting.layoutTycon denv infoReader ad m true WordL.keywordType x (* |> Layout.squashTo width *)
2187+
let layoutTycon denv infoReader ad m (* width *) x = TastDefinitionPrinting.layoutTycon denv infoReader ad m true WordL.keywordType x (* |> Display.squashTo width *)
21882188

21892189
let layoutUnionCases denv x = x |> TastDefinitionPrinting.layoutUnionCaseFields denv true
21902190

src/fsharp/Optimizer.fs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
module internal FSharp.Compiler.Optimizer
77

88
open Internal.Utilities
9+
open Internal.Utilities.StructuredFormat
910

1011
open FSharp.Compiler
1112
open FSharp.Compiler.AbstractIL.Diagnostics
@@ -1250,17 +1251,17 @@ let RemapOptimizationInfo g tmenv =
12501251
let AbstractAndRemapModulInfo msg g m (repackage, hidden) info =
12511252
let mrpi = mkRepackageRemapping repackage
12521253
#if DEBUG
1253-
if verboseOptimizationInfo then dprintf "%s - %a - Optimization data prior to trim: \n%s\n" msg outputRange m (Layout.showL (Layout.squashTo 192 (moduleInfoL g info)))
1254+
if verboseOptimizationInfo then dprintf "%s - %a - Optimization data prior to trim: \n%s\n" msg outputRange m (Layout.showL (Display.squashTo 192 (moduleInfoL g info)))
12541255
#else
12551256
ignore (msg, m)
12561257
#endif
12571258
let info = info |> AbstractLazyModulInfoByHiding false hidden
12581259
#if DEBUG
1259-
if verboseOptimizationInfo then dprintf "%s - %a - Optimization data after trim:\n%s\n" msg outputRange m (Layout.showL (Layout.squashTo 192 (moduleInfoL g info)))
1260+
if verboseOptimizationInfo then dprintf "%s - %a - Optimization data after trim:\n%s\n" msg outputRange m (Layout.showL (Display.squashTo 192 (moduleInfoL g info)))
12601261
#endif
12611262
let info = info |> RemapOptimizationInfo g mrpi
12621263
#if DEBUG
1263-
if verboseOptimizationInfo then dprintf "%s - %a - Optimization data after remap:\n%s\n" msg outputRange m (Layout.showL (Layout.squashTo 192 (moduleInfoL g info)))
1264+
if verboseOptimizationInfo then dprintf "%s - %a - Optimization data after remap:\n%s\n" msg outputRange m (Layout.showL (Display.squashTo 192 (moduleInfoL g info)))
12641265
#endif
12651266
info
12661267

src/fsharp/fsc.fs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ open System.Threading
2424
open Internal.Utilities
2525
open Internal.Utilities.Collections
2626
open Internal.Utilities.Filename
27+
open Internal.Utilities.StructuredFormat
2728

2829
open FSharp.Compiler
2930
open FSharp.Compiler.AbstractIL
@@ -321,7 +322,7 @@ module InterfaceFileWriter =
321322
for (TImplFile (_, _, mexpr, _, _, _)) in declaredImpls do
322323
let denv = BuildInitialDisplayEnvForSigFileGeneration tcGlobals
323324
writeViaBuffer os (fun os s -> Printf.bprintf os "%s\n\n" s)
324-
(NicePrint.layoutInferredSigOfModuleExpr true denv infoReader AccessibleFromSomewhere range0 mexpr |> Layout.squashTo 80 |> Layout.showL)
325+
(NicePrint.layoutInferredSigOfModuleExpr true denv infoReader AccessibleFromSomewhere range0 mexpr |> Display.squashTo 80 |> Layout.showL)
325326

326327
if tcConfig.printSignatureFile <> "" then os.Dispose()
327328

0 commit comments

Comments
 (0)