| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 var entry = mappings[first]; | 338 var entry = mappings[first]; |
| 339 if (!first && entry && | 339 if (!first && entry && |
| 340 (lineNumber < entry.lineNumber || (lineNumber === entry.lineNumber && co
lumnNumber < entry.columnNumber))) | 340 (lineNumber < entry.lineNumber || (lineNumber === entry.lineNumber && co
lumnNumber < entry.columnNumber))) |
| 341 return null; | 341 return null; |
| 342 return entry; | 342 return entry; |
| 343 } | 343 } |
| 344 | 344 |
| 345 /** | 345 /** |
| 346 * @param {string} sourceURL | 346 * @param {string} sourceURL |
| 347 * @param {number} lineNumber | 347 * @param {number} lineNumber |
| 348 * @return {?SDK.SourceMapEntry} | 348 * @return {!Array<!SDK.SourceMapEntry>} |
| 349 */ | 349 */ |
| 350 firstSourceLineMapping(sourceURL, lineNumber) { | 350 mappingsForLine(sourceURL, lineNumber) { |
| 351 var mappings = this._reversedMappings(sourceURL); | 351 var mappings = this._reversedMappings(sourceURL); |
| 352 var index = mappings.lowerBound(lineNumber, lineComparator); | 352 var startIndex = mappings.lowerBound(lineNumber, (lineNumber, mapping) => li
neNumber - mapping.sourceLineNumber); |
| 353 if (index >= mappings.length || mappings[index].sourceLineNumber !== lineNum
ber) | 353 var endIndex = startIndex; |
| 354 return null; | 354 while (endIndex < mappings.length && mappings[endIndex].sourceLineNumber ===
lineNumber) |
| 355 return mappings[index]; | 355 ++endIndex; |
| 356 | 356 return mappings.slice(startIndex, endIndex); |
| 357 /** | |
| 358 * @param {number} lineNumber | |
| 359 * @param {!SDK.SourceMapEntry} mapping | |
| 360 * @return {number} | |
| 361 */ | |
| 362 function lineComparator(lineNumber, mapping) { | |
| 363 return lineNumber - mapping.sourceLineNumber; | |
| 364 } | |
| 365 } | 357 } |
| 366 | 358 |
| 367 /** | 359 /** |
| 368 * @return {!Array<!SDK.SourceMapEntry>} | 360 * @return {!Array<!SDK.SourceMapEntry>} |
| 369 */ | 361 */ |
| 370 mappings() { | 362 mappings() { |
| 371 if (this._mappings === null) { | 363 if (this._mappings === null) { |
| 372 this._mappings = []; | 364 this._mappings = []; |
| 373 this._eachSection(this._parseMap.bind(this)); | 365 this._eachSection(this._parseMap.bind(this)); |
| 374 this._json = null; | 366 this._json = null; |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 * @param {?string} content | 594 * @param {?string} content |
| 603 * @param {?Array<!SDK.SourceMapEntry>} reverseMappings | 595 * @param {?Array<!SDK.SourceMapEntry>} reverseMappings |
| 604 */ | 596 */ |
| 605 constructor(content, reverseMappings) { | 597 constructor(content, reverseMappings) { |
| 606 this.content = content; | 598 this.content = content; |
| 607 this.reverseMappings = reverseMappings; | 599 this.reverseMappings = reverseMappings; |
| 608 } | 600 } |
| 609 }; | 601 }; |
| 610 | 602 |
| 611 SDK.TextSourceMap._sourcesListSymbol = Symbol('sourcesList'); | 603 SDK.TextSourceMap._sourcesListSymbol = Symbol('sourcesList'); |
| OLD | NEW |