Skip to content

Commit

Permalink
Remove capacity and list.
Browse files Browse the repository at this point in the history
  • Loading branch information
nojaf committed Sep 19, 2023
1 parent 11a4d1b commit 11b1934
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/Compiler/Facilities/prim-lexing.fs
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,9 @@ type StringText(str: string) =
line.Substring(range.StartColumn, length)
else
let firstLineContent = line.Substring(range.StartColumn)
let sb = System.Text.StringBuilder().AppendLine(firstLineContent)

let capacity =
[ (range.StartLine - 1) .. (range.EndLine - 1) ]
|> List.sumBy (fun lineIdx -> (sourceText.GetLineString lineIdx).Length)

let sb = System.Text.StringBuilder(capacity).AppendLine(firstLineContent)

for lineNumber in [ range.StartLine .. range.EndLine - 2 ] do
for lineNumber in range.StartLine .. range.EndLine - 2 do
sb.AppendLine(sourceText.GetLineString lineNumber) |> ignore

let lastLine = sourceText.GetLineString(range.EndLine - 1)
Expand Down

0 comments on commit 11b1934

Please sign in to comment.