Skip to content

Commit ec32fa2

Browse files
authored
Merge pull request #1480 from forki/printf
Cleanup printf
2 parents 6f42543 + 924c6a3 commit ec32fa2

File tree

1 file changed

+17
-20
lines changed

1 file changed

+17
-20
lines changed

src/fsharp/FSharp.Core/printf.fs

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -936,10 +936,7 @@ module internal PrintfImpl =
936936
System.Diagnostics.Debug.Assert((i = n), "i = n")
937937
buf.[i] <- ty
938938
buf
939-
go ty 0
940-
941-
[<Literal>]
942-
let ContinuationOnStack = -1
939+
go ty 0
943940

944941
type private PrintfBuilderStack() =
945942
let args = Stack(10)
@@ -951,7 +948,7 @@ module internal PrintfImpl =
951948
arr.[start + i] <- s.Pop()
952949
arr
953950

954-
member this.GetArgumentAndTypesAsArrays
951+
member __.GetArgumentAndTypesAsArrays
955952
(
956953
argsArraySize, argsArrayStartPos, argsArrayTotalCount,
957954
typesArraySize, typesArrayStartPos, typesArrayTotalCount
@@ -960,7 +957,7 @@ module internal PrintfImpl =
960957
let typesArray = stackToArray typesArraySize typesArrayStartPos typesArrayTotalCount types
961958
argsArray, typesArray
962959

963-
member this.PopContinuationWithType() =
960+
member __.PopContinuationWithType() =
964961
System.Diagnostics.Debug.Assert(args.Count = 1, "args.Count = 1")
965962
System.Diagnostics.Debug.Assert(types.Count = 1, "types.Count = 1")
966963

@@ -969,7 +966,7 @@ module internal PrintfImpl =
969966

970967
cont, contTy
971968

972-
member this.PopValueUnsafe() = args.Pop()
969+
member __.PopValueUnsafe() = args.Pop()
973970

974971
member this.PushContinuationWithType (cont : obj, contTy : Type) =
975972
System.Diagnostics.Debug.Assert(this.IsEmpty, "this.IsEmpty")
@@ -983,17 +980,17 @@ module internal PrintfImpl =
983980

984981
this.PushArgumentWithType(cont, contTy)
985982

986-
member this.PushArgument(value : obj) =
983+
member __.PushArgument(value : obj) =
987984
args.Push value
988985

989-
member this.PushArgumentWithType(value : obj, ty) =
986+
member __.PushArgumentWithType(value : obj, ty) =
990987
args.Push value
991988
types.Push ty
992989

993-
member this.HasContinuationOnStack(expectedNumberOfArguments) =
990+
member __.HasContinuationOnStack(expectedNumberOfArguments) =
994991
types.Count = expectedNumberOfArguments + 1
995992

996-
member this.IsEmpty =
993+
member __.IsEmpty =
997994
System.Diagnostics.Debug.Assert(args.Count = types.Count, "args.Count = types.Count")
998995
args.Count = 0
999996

@@ -1247,7 +1244,7 @@ module internal PrintfImpl =
12471244
else
12481245
buildPlain n prefix
12491246

1250-
member this.Build<'T>(s : string) : PrintfFactory<'S, 'Re, 'Res, 'T> * int =
1247+
member __.Build<'T>(s : string) : PrintfFactory<'S, 'Re, 'Res, 'T> * int =
12511248
parseFormatString s typeof<'T> :?> _, (2 * count + 1) // second component is used in SprintfEnv as value for internal buffer
12521249

12531250
/// Type of element that is stored in cache
@@ -1311,23 +1308,23 @@ module internal PrintfImpl =
13111308
let buf : string[] = Array.zeroCreate n
13121309
let mutable ptr = 0
13131310

1314-
override this.Finalize() : 'Result = k (String.Concat(buf))
1315-
override this.Write(s : string) =
1311+
override __.Finalize() : 'Result = k (String.Concat(buf))
1312+
override __.Write(s : string) =
13161313
buf.[ptr] <- s
13171314
ptr <- ptr + 1
13181315
override this.WriteT(s) = this.Write s
13191316

13201317
type StringBuilderPrintfEnv<'Result>(k, buf) =
13211318
inherit PrintfEnv<Text.StringBuilder, unit, 'Result>(buf)
1322-
override this.Finalize() : 'Result = k ()
1323-
override this.Write(s : string) = ignore(buf.Append(s))
1324-
override this.WriteT(()) = ()
1319+
override __.Finalize() : 'Result = k ()
1320+
override __.Write(s : string) = ignore(buf.Append(s))
1321+
override __.WriteT(()) = ()
13251322

13261323
type TextWriterPrintfEnv<'Result>(k, tw : IO.TextWriter) =
13271324
inherit PrintfEnv<IO.TextWriter, unit, 'Result>(tw)
1328-
override this.Finalize() : 'Result = k()
1329-
override this.Write(s : string) = tw.Write s
1330-
override this.WriteT(()) = ()
1325+
override __.Finalize() : 'Result = k()
1326+
override __.Write(s : string) = tw.Write s
1327+
override __.WriteT(()) = ()
13311328

13321329
let inline doPrintf fmt f =
13331330
let formatter, n = Cache<_, _, _, _>.Get fmt

0 commit comments

Comments
 (0)