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

Function getOriginalSymbolName

lib/internal/source_map/prepare_stack_trace.js:122–138  ·  view source on GitHub ↗
(sourceMap, callSite, callerCallSite)

Source from the content-addressed store, hash-verified

120// Transpilers may have removed the original symbol name used in the stack
121// trace, if possible restore it from the names field of the source map:
122function getOriginalSymbolName(sourceMap, callSite, callerCallSite) {
123 // First check for a symbol name associated with the enclosing function:
124 const enclosingEntry = sourceMap.findEntry(
125 callSite.getEnclosingLineNumber() - 1,
126 callSite.getEnclosingColumnNumber() - 1,
127 );
128 if (enclosingEntry.name) return enclosingEntry.name;
129 // Fallback to using the symbol name attached to the caller site:
130 const currentFileName = callSite.getFileName();
131 if (callerCallSite && currentFileName === callerCallSite.getFileName()) {
132 const { name } = sourceMap.findEntry(
133 callerCallSite.getLineNumber() - 1,
134 callerCallSite.getColumnNumber() - 1,
135 );
136 return name;
137 }
138}
139
140/**
141 * Return a snippet of code from where the exception was originally thrown

Callers 1

serializeJSStackFrameFunction · 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…