@@ -136,6 +136,7 @@ type Printer struct {
136
136
inExtends bool // whether we are emitting the `extends` clause of a ConditionalType or InferType
137
137
nameGenerator NameGenerator
138
138
makeFileLevelOptimisticUniqueName func (string ) string
139
+ commentStatePool core.Pool [commentState ]
139
140
}
140
141
141
142
type detachedCommentsInfo struct {
@@ -4993,7 +4994,9 @@ func (p *Printer) emitCommentsBeforeNode(node *ast.Node) *commentState {
4993
4994
p .commentsDisabled = true
4994
4995
}
4995
4996
4996
- return & commentState {emitFlags , commentRange , containerPos , containerEnd , declarationListContainerEnd }
4997
+ c := p .commentStatePool .New ()
4998
+ * c = commentState {emitFlags , commentRange , containerPos , containerEnd , declarationListContainerEnd }
4999
+ return c
4997
5000
}
4998
5001
4999
5002
func (p * Printer ) emitCommentsAfterNode (node * ast.Node , state * commentState ) {
@@ -5046,7 +5049,7 @@ func (p *Printer) emitCommentsBeforeToken(token ast.Kind, pos int, contextNode *
5046
5049
p .decreaseIndentIf (needsIndent )
5047
5050
}
5048
5051
5049
- return & commentState {} , pos
5052
+ return p . commentStatePool . New () , pos
5050
5053
}
5051
5054
5052
5055
func (p * Printer ) emitCommentsAfterToken (token ast.Kind , pos int , contextNode * ast.Node , state * commentState ) {
0 commit comments