MCPcopy Index your code
hub / github.com/nodejs/node / emitTokenWithSourceMap

Function emitTokenWithSourceMap

test/fixtures/snapshot/typescript.js:115118–115137  ·  view source on GitHub ↗

* Emits a token of a node with possible leading and trailing source maps. * * @param node The node containing the token. * @param token The token to emit. * @param tokenStartPos The start pos of the token. * @param emitCallback The callback used to emit t

(node, token, writer, tokenPos, emitCallback)

Source from the content-addressed store, hash-verified

115116 * @param emitCallback The callback used to emit the token.
115117 */
115118 function emitTokenWithSourceMap(node, token, writer, tokenPos, emitCallback) {
115119 if (sourceMapsDisabled || node && ts.isInJsonFile(node)) {
115120 return emitCallback(token, writer, tokenPos);
115121 }
115122 var emitNode = node && node.emitNode;
115123 var emitFlags = emitNode && emitNode.flags || 0 /* EmitFlags.None */;
115124 var range = emitNode && emitNode.tokenSourceMapRanges && emitNode.tokenSourceMapRanges[token];
115125 var source = range && range.source || sourceMapSource;
115126 tokenPos = skipSourceTrivia(source, range ? range.pos : tokenPos);
115127 if ((emitFlags & 128 /* EmitFlags.NoTokenLeadingSourceMaps */) === 0 && tokenPos >= 0) {
115128 emitSourcePos(source, tokenPos);
115129 }
115130 tokenPos = emitCallback(token, writer, tokenPos);
115131 if (range)
115132 tokenPos = range.end;
115133 if ((emitFlags & 256 /* EmitFlags.NoTokenTrailingSourceMaps */) === 0 && tokenPos >= 0) {
115134 emitSourcePos(source, tokenPos);
115135 }
115136 return tokenPos;
115137 }
115138 function setSourceMapSource(source) {
115139 if (sourceMapsDisabled) {
115140 return;

Callers 1

writeTokenFunction · 0.85

Calls 2

skipSourceTriviaFunction · 0.85
emitSourcePosFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…