MCPcopy Index your code
hub / github.com/microsoft/typescript-go / emitCommentsAfterNode

Method emitCommentsAfterNode

internal/printer/printer.go:5280–5303  ·  view source on GitHub ↗
(node *ast.Node, state *commentState)

Source from the content-addressed store, hash-verified

5278}
5279
5280func (p *Printer) emitCommentsAfterNode(node *ast.Node, state *commentState) {
5281 if state == nil {
5282 return
5283 }
5284
5285 emitFlags := state.emitFlags
5286 commentRange := state.commentRange
5287 containerPos := state.containerPos
5288 containerEnd := state.containerEnd
5289 declarationListContainerEnd := state.declarationListContainerEnd
5290
5291 // Emit trailing comments
5292 if emitFlags&EFNoNestedComments != 0 {
5293 p.commentsDisabled = false
5294 }
5295
5296 p.emitTrailingSyntheticCommentsOfNode(node, emitFlags)
5297 p.emitTrailingCommentsOfNode(node, emitFlags, commentRange, containerPos, containerEnd, declarationListContainerEnd)
5298
5299 // Preserve comments from erased type annotation
5300 if typeNode := p.emitContext.GetTypeNode(node); typeNode != nil {
5301 p.emitTrailingCommentsOfNode(node, emitFlags, typeNode.Loc, containerPos, containerEnd, declarationListContainerEnd)
5302 }
5303}
5304
5305func (p *Printer) emitCommentsBeforeToken(token ast.Kind, pos int, contextNode *ast.Node, flags tokenEmitFlags) (*commentState, int) {
5306 if flags&tefNoComments != 0 || p.commentsDisabled {

Callers 2

exitNodeMethod · 0.95
exitTokenNodeMethod · 0.95

Calls 3

GetTypeNodeMethod · 0.80

Tested by

no test coverage detected