MCPcopy Create free account
hub / github.com/microsoft/typescript-go / shouldEmitTokenSourceMaps

Method shouldEmitTokenSourceMaps

internal/printer/printer.go:819–827  ·  view source on GitHub ↗
(token ast.Kind, pos int, contextNode *ast.Node, flags tokenEmitFlags)

Source from the content-addressed store, hash-verified

817}
818
819func (p *Printer) shouldEmitTokenSourceMaps(token ast.Kind, pos int, contextNode *ast.Node, flags tokenEmitFlags) bool {
820 // We don't emit source positions for most tokens as it tends to be quite noisy, however
821 // we need to emit source positions for open and close braces so that tools like istanbul
822 // can map branches for code coverage. However, we still omit brace source positions when
823 // the output is a declaration file.
824 return flags&tefNoSourceMaps == 0 &&
825 p.shouldEmitSourceMaps(contextNode) &&
826 !p.Options.OmitBraceSourceMapPositions && (token == ast.KindOpenBraceToken || token == ast.KindCloseBraceToken)
827}
828
829func (p *Printer) shouldEmitLeadingComments(node *ast.Node) bool {
830 return p.emitContext.EmitFlags(node)&EFNoLeadingComments == 0

Callers 1

Calls 1

shouldEmitSourceMapsMethod · 0.95

Tested by

no test coverage detected