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

Function _parseMap

deps/v8/tools/sourcemap.mjs:229–301  ·  view source on GitHub ↗

* @override

(map, lineNumber, columnNumber)

Source from the content-addressed store, hash-verified

227 * @override
228 */
229 _parseMap(map, lineNumber, columnNumber)
230 {
231 let sourceIndex = 0;
232 let sourceLineNumber = 0;
233 let sourceColumnNumber = 0;
234 let nameIndex = 0;
235
236 const sources = [];
237 const originalToCanonicalURLMap = {};
238 for (let i = 0; i < map.sources.length; ++i) {
239 const originalSourceURL = map.sources[i];
240 let sourceRoot = map.sourceRoot || "";
241 if (sourceRoot && !sourceRoot.endsWith("/")) sourceRoot += "/";
242 const href = sourceRoot + originalSourceURL;
243 const url = WebInspector.ParsedURL.completeURL(this._sourceMappingURL, href) || href;
244 originalToCanonicalURLMap[originalSourceURL] = url;
245 sources.push(url);
246 this._sources[url] = true;
247
248 if (map.sourcesContent && map.sourcesContent[i]) {
249 this._sourceContentByURL[url] = map.sourcesContent[i];
250 }
251 }
252
253 const stringCharIterator = new WebInspector.SourceMap.StringCharIterator(map.mappings);
254 let sourceURL = sources[sourceIndex];
255
256 while (true) {
257 if (stringCharIterator.peek() === ",")
258 stringCharIterator.next();
259 else {
260 while (stringCharIterator.peek() === ";") {
261 lineNumber += 1;
262 columnNumber = 0;
263 stringCharIterator.next();
264 }
265 if (!stringCharIterator.hasNext())
266 break;
267 }
268
269 columnNumber += this._decodeVLQ(stringCharIterator);
270 if (this._isSeparator(stringCharIterator.peek())) {
271 this._mappings.push([lineNumber, columnNumber]);
272 continue;
273 }
274
275 const sourceIndexDelta = this._decodeVLQ(stringCharIterator);
276 if (sourceIndexDelta) {
277 sourceIndex += sourceIndexDelta;
278 sourceURL = sources[sourceIndex];
279 }
280 sourceLineNumber += this._decodeVLQ(stringCharIterator);
281 sourceColumnNumber += this._decodeVLQ(stringCharIterator);
282 if (!this._isSeparator(stringCharIterator.peek()))
283 nameIndex += this._decodeVLQ(stringCharIterator);
284
285 this._mappings.push([lineNumber, columnNumber, sourceURL, sourceLineNumber, sourceColumnNumber]);
286 }

Callers

nothing calls this directly

Calls 4

peekMethod · 0.95
nextMethod · 0.95
hasNextMethod · 0.95
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…