* @override
(map, lineNumber, columnNumber)
| 255 | * @override |
| 256 | */ |
| 257 | #parseMap(map, lineNumber, columnNumber) { |
| 258 | let sourceIndex = 0; |
| 259 | let sourceLineNumber = 0; |
| 260 | let sourceColumnNumber = 0; |
| 261 | let nameIndex = 0; |
| 262 | |
| 263 | const sources = []; |
| 264 | const originalToCanonicalURLMap = {}; |
| 265 | for (let i = 0; i < map.sources.length; ++i) { |
| 266 | const url = map.sources[i]; |
| 267 | originalToCanonicalURLMap[url] = url; |
| 268 | ArrayPrototypePush(sources, url); |
| 269 | this.#sources[url] = true; |
| 270 | |
| 271 | if (map.sourcesContent?.[i]) |
| 272 | this.#sourceContentByURL[url] = map.sourcesContent[i]; |
| 273 | } |
| 274 | |
| 275 | const stringCharIterator = new StringCharIterator(map.mappings); |
| 276 | let sourceURL = sources[sourceIndex]; |
| 277 | while (true) { |
| 278 | if (stringCharIterator.peek() === ',') |
| 279 | stringCharIterator.next(); |
| 280 | else { |
| 281 | while (stringCharIterator.peek() === ';') { |
| 282 | lineNumber += 1; |
| 283 | columnNumber = 0; |
| 284 | stringCharIterator.next(); |
| 285 | } |
| 286 | if (!stringCharIterator.hasNext()) |
| 287 | break; |
| 288 | } |
| 289 | |
| 290 | columnNumber += decodeVLQ(stringCharIterator); |
| 291 | if (isSeparator(stringCharIterator.peek())) { |
| 292 | ArrayPrototypePush(this.#mappings, [lineNumber, columnNumber]); |
| 293 | continue; |
| 294 | } |
| 295 | |
| 296 | const sourceIndexDelta = decodeVLQ(stringCharIterator); |
| 297 | if (sourceIndexDelta) { |
| 298 | sourceIndex += sourceIndexDelta; |
| 299 | sourceURL = sources[sourceIndex]; |
| 300 | } |
| 301 | sourceLineNumber += decodeVLQ(stringCharIterator); |
| 302 | sourceColumnNumber += decodeVLQ(stringCharIterator); |
| 303 | |
| 304 | let name; |
| 305 | if (!isSeparator(stringCharIterator.peek())) { |
| 306 | nameIndex += decodeVLQ(stringCharIterator); |
| 307 | name = map.names?.[nameIndex]; |
| 308 | } |
| 309 | |
| 310 | ArrayPrototypePush( |
| 311 | this.#mappings, |
| 312 | [lineNumber, columnNumber, sourceURL, sourceLineNumber, |
| 313 | sourceColumnNumber, name], |
| 314 | ); |