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 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 ); | 536 ); |
537 | 537 |
538 | 538 |
539 // Returns the offset of the given position within the containing | 539 // Returns the offset of the given position within the containing |
540 // line. | 540 // line. |
541 function GetPositionInLine(message) { | 541 function GetPositionInLine(message) { |
542 var script = %MessageGetScript(message); | 542 var script = %MessageGetScript(message); |
543 var start_position = %MessageGetStartPosition(message); | 543 var start_position = %MessageGetStartPosition(message); |
544 var location = script.locationFromPosition(start_position, false); | 544 var location = script.locationFromPosition(start_position, false); |
545 if (location == null) return -1; | 545 if (location == null) return -1; |
546 return start_position - location.start; | 546 return location.column; |
547 } | 547 } |
548 | 548 |
549 | 549 |
550 function GetStackTraceLine(recv, fun, pos, isGlobal) { | 550 function GetStackTraceLine(recv, fun, pos, isGlobal) { |
551 return new CallSite(recv, fun, pos, false).toString(); | 551 return new CallSite(recv, fun, pos, false).toString(); |
552 } | 552 } |
553 | 553 |
554 // ---------------------------------------------------------------------------- | 554 // ---------------------------------------------------------------------------- |
555 // Error implementation | 555 // Error implementation |
556 | 556 |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1094 // Define accessors first, as this may fail and throw. | 1094 // Define accessors first, as this may fail and throw. |
1095 ObjectDefineProperty(obj, 'stack', { get: StackTraceGetter, | 1095 ObjectDefineProperty(obj, 'stack', { get: StackTraceGetter, |
1096 set: StackTraceSetter, | 1096 set: StackTraceSetter, |
1097 configurable: true }); | 1097 configurable: true }); |
1098 %CollectStackTrace(obj, cons_opt ? cons_opt : captureStackTrace); | 1098 %CollectStackTrace(obj, cons_opt ? cons_opt : captureStackTrace); |
1099 }; | 1099 }; |
1100 | 1100 |
1101 GlobalError.captureStackTrace = captureStackTrace; | 1101 GlobalError.captureStackTrace = captureStackTrace; |
1102 | 1102 |
1103 }); | 1103 }); |
OLD | NEW |