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

Method emitTrailingCommentsOfNode

internal/printer/printer.go:5421–5437  ·  view source on GitHub ↗
(node *ast.Node, emitFlags EmitFlags, commentRange core.TextRange, containerPos int, containerEnd int, declarationListContainerEnd int)

Source from the content-addressed store, hash-verified

5419}
5420
5421func (p *Printer) emitTrailingCommentsOfNode(node *ast.Node, emitFlags EmitFlags, commentRange core.TextRange, containerPos int, containerEnd int, declarationListContainerEnd int) {
5422 pos := commentRange.Pos()
5423 end := commentRange.End()
5424 skipTrailingComments := end < 0 || (emitFlags&EFNoTrailingComments) != 0 || node.Kind == ast.KindJsxText
5425 if (!ast.PositionIsSynthesized(pos) || !ast.PositionIsSynthesized(end)) && pos != end {
5426 // Restore previous container state.
5427 p.containerPos = containerPos
5428 p.containerEnd = containerEnd
5429 p.declarationListContainerEnd = declarationListContainerEnd
5430
5431 // Emit trailing comments if the position is not synthesized and the node
5432 // has not opted out from emitting leading comments and is an emitted node.
5433 if !skipTrailingComments && node.Kind != ast.KindNotEmittedStatement {
5434 p.emitTrailingComments(end, commentSeparatorBefore)
5435 }
5436 }
5437}
5438
5439func (p *Printer) emitLeadingSyntheticCommentsOfNode(node *ast.Node, emitFlags EmitFlags) {
5440 if emitFlags&EFNoLeadingComments != 0 {

Callers 1

emitCommentsAfterNodeMethod · 0.95

Calls 4

emitTrailingCommentsMethod · 0.95
PositionIsSynthesizedFunction · 0.92
PosMethod · 0.65
EndMethod · 0.65

Tested by

no test coverage detected