Skip to content

Commit

Permalink
Write-back uses unbuffered writer
Browse files Browse the repository at this point in the history
Encoder has 8Kb buffer.
  • Loading branch information
som-snytt committed Jul 8, 2022
1 parent b5e2279 commit 2299b60
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions compiler/src/dotty/tools/dotc/rewrites/Rewrites.scala
Expand Up @@ -56,13 +56,11 @@ object Rewrites {
ds
}

def writeBack(): Unit = {
def writeBack(): Unit =
val chars = apply(source.underlying.content)
val bytes = new String(chars).getBytes(UTF_8)
val out = source.file.output
out.write(bytes)
out.close()
}
val osw = OutputStreamWriter(source.file.output, UTF_8)
try osw.write(chars, 0, chars.length)
finally osw.close()
}

/** If -rewrite is set, record a patch that replaces the range
Expand Down

0 comments on commit 2299b60

Please sign in to comment.