mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-10-28 16:36:04 +08:00
Only pre-size the printer buffer when printing a whole file (#64972)
This commit is contained in:
1 parent
49e6983021
commit
1f82f368b6
1 file changed
+1
-1
@@ -5095,7 +5095,7 @@ func (p *Printer) Write(node *ast.Node, sourceFile *ast.SourceFile, writer EmitT
|
||||
}
|
||||
p.writer = writer
|
||||
p.writer.Clear()
|
||||
if sourceFile != nil {
|
||||
if sourceFile != nil && node == sourceFile.AsNode() {
|
||||
if grower, ok := p.writer.(interface{ Grow(n int) }); ok {
|
||||
grower.Grow(len(sourceFile.Text()))
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user