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

Method emitSourceMapsBeforeNode

internal/printer/printer.go:5872–5894  ·  view source on GitHub ↗

TODO: Support emitting nameIndex for source maps func (p *Printer) emitSourcePosName(source sourcemap.Source, pos int, name string) { if source != p.sourceMapSource { savedSourceMapSource := p.sourceMapSource savedSourceMapSourceIndex := p.sourceMapSourceIndex p.setSourceMapSource(source) p

(node *ast.Node)

Source from the content-addressed store, hash-verified

5870////}
5871
5872func (p *Printer) emitSourceMapsBeforeNode(node *ast.Node) *sourceMapState {
5873 if !p.shouldEmitSourceMaps(node) {
5874 return nil
5875 }
5876
5877 emitFlags := p.emitContext.EmitFlags(node)
5878 loc := p.emitContext.SourceMapRange(node)
5879
5880 if !ast.IsNotEmittedStatement(node) &&
5881 emitFlags&EFNoLeadingSourceMap == 0 &&
5882 p.currentSourceFile != nil &&
5883 !ast.PositionIsSynthesized(loc.Pos()) {
5884 p.emitSourcePos(p.sourceMapSource, scanner.SkipTrivia(p.currentSourceFile.Text(), loc.Pos()))
5885 }
5886
5887 if emitFlags&EFNoNestedSourceMaps != 0 {
5888 p.sourceMapsDisabled = true
5889 }
5890
5891 state := p.sourceMapStateArena.New()
5892 *state = sourceMapState{emitFlags, loc, false}
5893 return state
5894}
5895
5896func (p *Printer) emitSourceMapsAfterNode(node *ast.Node, previousState *sourceMapState) {
5897 if previousState == nil {

Callers 2

enterNodeMethod · 0.95
enterTokenNodeMethod · 0.95

Calls 10

shouldEmitSourceMapsMethod · 0.95
emitSourcePosMethod · 0.95
IsNotEmittedStatementFunction · 0.92
PositionIsSynthesizedFunction · 0.92
SkipTriviaFunction · 0.92
EmitFlagsMethod · 0.80
SourceMapRangeMethod · 0.80
NewMethod · 0.80
PosMethod · 0.65
TextMethod · 0.65

Tested by

no test coverage detected