| 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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 return entry; | 221 return entry; |
| 222 }, | 222 }, |
| 223 | 223 |
| 224 /** | 224 /** |
| 225 * @param {string} sourceURL | 225 * @param {string} sourceURL |
| 226 * @param {number} lineNumber | 226 * @param {number} lineNumber |
| 227 * @return {?WebInspector.SourceMap.Entry} | 227 * @return {?WebInspector.SourceMap.Entry} |
| 228 */ | 228 */ |
| 229 firstSourceLineMapping: function(sourceURL, lineNumber) | 229 firstSourceLineMapping: function(sourceURL, lineNumber) |
| 230 { | 230 { |
| 231 var mappings = this._reversedMappings(sourceURL); | 231 var mappings = this.reversedMappings(sourceURL); |
| 232 var index = mappings.lowerBound(lineNumber, lineComparator); | 232 var index = mappings.lowerBound(lineNumber, lineComparator); |
| 233 if (index >= mappings.length || mappings[index].sourceLineNumber !== lin
eNumber) | 233 if (index >= mappings.length || mappings[index].sourceLineNumber !== lin
eNumber) |
| 234 return null; | 234 return null; |
| 235 return mappings[index]; | 235 return mappings[index]; |
| 236 | 236 |
| 237 /** | 237 /** |
| 238 * @param {number} lineNumber | 238 * @param {number} lineNumber |
| 239 * @param {!WebInspector.SourceMap.Entry} mapping | 239 * @param {!WebInspector.SourceMap.Entry} mapping |
| 240 * @return {number} | 240 * @return {number} |
| 241 */ | 241 */ |
| 242 function lineComparator(lineNumber, mapping) | 242 function lineComparator(lineNumber, mapping) |
| 243 { | 243 { |
| 244 return lineNumber - mapping.sourceLineNumber; | 244 return lineNumber - mapping.sourceLineNumber; |
| 245 } | 245 } |
| 246 }, | 246 }, |
| 247 | 247 |
| 248 /** | 248 /** |
| 249 * @return {!Array<!WebInspector.SourceMap.Entry>} | 249 * @return {!Array<!WebInspector.SourceMap.Entry>} |
| 250 */ | 250 */ |
| 251 mappings: function() | 251 mappings: function() |
| 252 { | 252 { |
| 253 return this._mappings; | 253 return this._mappings; |
| 254 }, | 254 }, |
| 255 | 255 |
| 256 /** | 256 /** |
| 257 * @param {string} sourceURL | 257 * @param {string} sourceURL |
| 258 * @return {!Array.<!WebInspector.SourceMap.Entry>} | 258 * @return {!Array.<!WebInspector.SourceMap.Entry>} |
| 259 */ | 259 */ |
| 260 _reversedMappings: function(sourceURL) | 260 reversedMappings: function(sourceURL) |
| 261 { | 261 { |
| 262 var mappings = this._reverseMappingsBySourceURL.get(sourceURL); | 262 var mappings = this._reverseMappingsBySourceURL.get(sourceURL); |
| 263 if (!mappings) | 263 if (!mappings) |
| 264 return []; | 264 return []; |
| 265 if (!mappings._sorted) { | 265 if (!mappings._sorted) { |
| 266 mappings.sort(sourceMappingComparator); | 266 mappings.sort(sourceMappingComparator); |
| 267 mappings._sorted = true; | 267 mappings._sorted = true; |
| 268 } | 268 } |
| 269 return mappings; | 269 return mappings; |
| 270 | 270 |
| 271 /** | 271 /** |
| 272 * @param {!WebInspector.SourceMap.Entry} a | 272 * @param {!WebInspector.SourceMap.Entry} a |
| 273 * @param {!WebInspector.SourceMap.Entry} b | 273 * @param {!WebInspector.SourceMap.Entry} b |
| 274 * @return {number} | 274 * @return {number} |
| 275 */ | 275 */ |
| 276 function sourceMappingComparator(a, b) | 276 function sourceMappingComparator(a, b) |
| 277 { | 277 { |
| 278 if (a.sourceLineNumber !== b.sourceLineNumber) | 278 if (a.sourceLineNumber !== b.sourceLineNumber) |
| 279 return a.sourceLineNumber - b.sourceLineNumber; | 279 return a.sourceLineNumber - b.sourceLineNumber; |
| 280 return a.sourceColumnNumber - b.sourceColumnNumber; | 280 if (a.sourceColumnNumber !== b.sourceColumnNumber) |
| 281 return a.sourceColumnNumber - b.sourceColumnNumber; |
| 282 |
| 283 if (a.lineNumber !== b.lineNumber) |
| 284 return a.lineNumber - b.lineNumber; |
| 285 |
| 286 return a.columnNumber - b.columnNumber; |
| 281 } | 287 } |
| 282 }, | 288 }, |
| 283 | 289 |
| 284 /** | 290 /** |
| 285 * @param {!SourceMapV3} map | 291 * @param {!SourceMapV3} map |
| 286 * @param {number} lineNumber | 292 * @param {number} lineNumber |
| 287 * @param {number} columnNumber | 293 * @param {number} columnNumber |
| 288 */ | 294 */ |
| 289 _parseMap: function(map, lineNumber, columnNumber) | 295 _parseMap: function(map, lineNumber, columnNumber) |
| 290 { | 296 { |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 */ | 446 */ |
| 441 WebInspector.SourceMap.Entry = function(lineNumber, columnNumber, sourceURL, sou
rceLineNumber, sourceColumnNumber, name) | 447 WebInspector.SourceMap.Entry = function(lineNumber, columnNumber, sourceURL, sou
rceLineNumber, sourceColumnNumber, name) |
| 442 { | 448 { |
| 443 this.lineNumber = lineNumber; | 449 this.lineNumber = lineNumber; |
| 444 this.columnNumber = columnNumber; | 450 this.columnNumber = columnNumber; |
| 445 this.sourceURL = sourceURL; | 451 this.sourceURL = sourceURL; |
| 446 this.sourceLineNumber = sourceLineNumber; | 452 this.sourceLineNumber = sourceLineNumber; |
| 447 this.sourceColumnNumber = sourceColumnNumber; | 453 this.sourceColumnNumber = sourceColumnNumber; |
| 448 this.name = name; | 454 this.name = name; |
| 449 } | 455 } |
| OLD | NEW |