| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // ------------------------------------------------------------------- | 5 // ------------------------------------------------------------------- |
| 6 | 6 |
| 7 var $errorToString; | 7 var $errorToString; |
| 8 var $getStackTraceLine; | 8 var $getStackTraceLine; |
| 9 var $messageGetPositionInLine; | 9 var $messageGetPositionInLine; |
| 10 var $messageGetLineNumber; | 10 var $messageGetLineNumber; |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 * @return {number} | 389 * @return {number} |
| 390 * Number of source lines. | 390 * Number of source lines. |
| 391 */ | 391 */ |
| 392 function ScriptLineCount() { | 392 function ScriptLineCount() { |
| 393 // Return number of source lines. | 393 // Return number of source lines. |
| 394 return this.line_ends.length; | 394 return this.line_ends.length; |
| 395 } | 395 } |
| 396 | 396 |
| 397 | 397 |
| 398 /** | 398 /** |
| 399 * Returns the position of the nth line end. |
| 400 * @return {number} |
| 401 * Zero-based position of the nth line end in the script. |
| 402 */ |
| 403 function ScriptLineEnd(n) { |
| 404 return this.line_ends[n]; |
| 405 } |
| 406 |
| 407 |
| 408 /** |
| 399 * If sourceURL comment is available returns sourceURL comment contents. | 409 * If sourceURL comment is available returns sourceURL comment contents. |
| 400 * Otherwise, script name is returned. See | 410 * Otherwise, script name is returned. See |
| 401 * http://fbug.googlecode.com/svn/branches/firebug1.1/docs/ReleaseNotes_1.1.txt | 411 * http://fbug.googlecode.com/svn/branches/firebug1.1/docs/ReleaseNotes_1.1.txt |
| 402 * and Source Map Revision 3 proposal for details on using //# sourceURL and | 412 * and Source Map Revision 3 proposal for details on using //# sourceURL and |
| 403 * deprecated //@ sourceURL comment to identify scripts that don't have name. | 413 * deprecated //@ sourceURL comment to identify scripts that don't have name. |
| 404 * | 414 * |
| 405 * @return {?string} script name if present, value for //# sourceURL or | 415 * @return {?string} script name if present, value for //# sourceURL or |
| 406 * deprecated //@ sourceURL comment otherwise. | 416 * deprecated //@ sourceURL comment otherwise. |
| 407 */ | 417 */ |
| 408 function ScriptNameOrSourceURL() { | 418 function ScriptNameOrSourceURL() { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 419 "line_ends", | 429 "line_ends", |
| 420 "line_offset", | 430 "line_offset", |
| 421 "column_offset" | 431 "column_offset" |
| 422 ], [ | 432 ], [ |
| 423 "lineFromPosition", ScriptLineFromPosition, | 433 "lineFromPosition", ScriptLineFromPosition, |
| 424 "locationFromPosition", ScriptLocationFromPosition, | 434 "locationFromPosition", ScriptLocationFromPosition, |
| 425 "locationFromLine", ScriptLocationFromLine, | 435 "locationFromLine", ScriptLocationFromLine, |
| 426 "sourceSlice", ScriptSourceSlice, | 436 "sourceSlice", ScriptSourceSlice, |
| 427 "sourceLine", ScriptSourceLine, | 437 "sourceLine", ScriptSourceLine, |
| 428 "lineCount", ScriptLineCount, | 438 "lineCount", ScriptLineCount, |
| 429 "nameOrSourceURL", ScriptNameOrSourceURL | 439 "nameOrSourceURL", ScriptNameOrSourceURL, |
| 440 "lineEnd", ScriptLineEnd |
| 430 ] | 441 ] |
| 431 ); | 442 ); |
| 432 | 443 |
| 433 | 444 |
| 434 /** | 445 /** |
| 435 * Class for source location. A source location is a position within some | 446 * Class for source location. A source location is a position within some |
| 436 * source with the following properties: | 447 * source with the following properties: |
| 437 * script : script object for the source | 448 * script : script object for the source |
| 438 * line : source line number | 449 * line : source line number |
| 439 * column : source column within the line | 450 * column : source column within the line |
| (...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1083 // Define accessors first, as this may fail and throw. | 1094 // Define accessors first, as this may fail and throw. |
| 1084 ObjectDefineProperty(obj, 'stack', { get: StackTraceGetter, | 1095 ObjectDefineProperty(obj, 'stack', { get: StackTraceGetter, |
| 1085 set: StackTraceSetter, | 1096 set: StackTraceSetter, |
| 1086 configurable: true }); | 1097 configurable: true }); |
| 1087 %CollectStackTrace(obj, cons_opt ? cons_opt : captureStackTrace); | 1098 %CollectStackTrace(obj, cons_opt ? cons_opt : captureStackTrace); |
| 1088 }; | 1099 }; |
| 1089 | 1100 |
| 1090 GlobalError.captureStackTrace = captureStackTrace; | 1101 GlobalError.captureStackTrace = captureStackTrace; |
| 1091 | 1102 |
| 1092 }); | 1103 }); |
| OLD | NEW |