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

Function reconstructCallSite

lib/util.js:510–525  ·  view source on GitHub ↗

* @param {CallSite} callSite // The call site object to reconstruct from source map * @returns {CallSite | undefined} // The reconstructed call site object

(callSite)

Source from the content-addressed store, hash-verified

508 * @returns {CallSite | undefined} // The reconstructed call site object
509 */
510function reconstructCallSite(callSite) {
511 const { scriptName, lineNumber, columnNumber } = callSite;
512 const sourceMap = lazySourceMap().findSourceMap(scriptName);
513 if (!sourceMap) return;
514 const entry = sourceMap.findEntry(lineNumber - 1, columnNumber - 1);
515 if (!entry?.originalSource) return;
516 return {
517 __proto__: null,
518 // If the name is not found, it is an empty string to match the behavior of `util.getCallSite()`
519 functionName: entry.name ?? '',
520 scriptName: entry.originalSource,
521 lineNumber: entry.originalLine + 1,
522 column: entry.originalColumn + 1,
523 columnNumber: entry.originalColumn + 1,
524 };
525}
526
527/**
528 *

Callers 1

mapCallSiteFunction · 0.85

Calls 1

findEntryMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…