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

Method emitCommentsBeforeNode

internal/printer/printer.go:5257–5278  ·  view source on GitHub ↗

Comments

(node *ast.Node)

Source from the content-addressed store, hash-verified

5255//
5256
5257func (p *Printer) emitCommentsBeforeNode(node *ast.Node) *commentState {
5258 if !p.shouldEmitComments(node) {
5259 return nil
5260 }
5261
5262 emitFlags := p.emitContext.EmitFlags(node)
5263 commentRange := p.emitContext.CommentRange(node)
5264 containerPos := p.containerPos
5265 containerEnd := p.containerEnd
5266 declarationListContainerEnd := p.declarationListContainerEnd
5267
5268 // Emit leading comments
5269 p.emitLeadingCommentsOfNode(node, emitFlags, commentRange)
5270 p.emitLeadingSyntheticCommentsOfNode(node, emitFlags)
5271 if emitFlags&EFNoNestedComments != 0 {
5272 p.commentsDisabled = true
5273 }
5274
5275 c := p.commentStateArena.New()
5276 *c = commentState{emitFlags, commentRange, containerPos, containerEnd, declarationListContainerEnd}
5277 return c
5278}
5279
5280func (p *Printer) emitCommentsAfterNode(node *ast.Node, state *commentState) {
5281 if state == nil {

Callers 2

enterNodeMethod · 0.95
enterTokenNodeMethod · 0.95

Calls 6

shouldEmitCommentsMethod · 0.95
EmitFlagsMethod · 0.80
CommentRangeMethod · 0.80
NewMethod · 0.80

Tested by

no test coverage detected