(token ast.Kind, pos int, contextNode *ast.Node, flags tokenEmitFlags)
| 5913 | } |
| 5914 | |
| 5915 | func (p *Printer) emitSourceMapsBeforeToken(token ast.Kind, pos int, contextNode *ast.Node, flags tokenEmitFlags) *sourceMapState { |
| 5916 | if !p.shouldEmitTokenSourceMaps(token, pos, contextNode, flags) { |
| 5917 | return nil |
| 5918 | } |
| 5919 | |
| 5920 | emitFlags := p.emitContext.EmitFlags(contextNode) |
| 5921 | loc, hasLoc := p.emitContext.TokenSourceMapRange(contextNode, token) |
| 5922 | if hasLoc { |
| 5923 | pos = loc.Pos() |
| 5924 | } |
| 5925 | if pos >= 0 && p.currentSourceFile != nil { |
| 5926 | pos = scanner.SkipTrivia(p.currentSourceFile.Text(), pos) |
| 5927 | } |
| 5928 | if emitFlags&EFNoTokenLeadingSourceMaps == 0 && pos >= 0 { |
| 5929 | p.emitSourcePos(p.sourceMapSource, pos) |
| 5930 | } |
| 5931 | |
| 5932 | state := p.sourceMapStateArena.New() |
| 5933 | *state = sourceMapState{emitFlags, loc, hasLoc} |
| 5934 | return state |
| 5935 | } |
| 5936 | |
| 5937 | func (p *Printer) emitSourceMapsAfterToken(token ast.Kind, pos int, contextNode *ast.Node, previousState *sourceMapState) { |
| 5938 | if previousState == nil { |
no test coverage detected