OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 // Returns the offset of the given position within the containing | 594 // Returns the offset of the given position within the containing |
595 // line. | 595 // line. |
596 function GetPositionInLine(message) { | 596 function GetPositionInLine(message) { |
597 var location = message.script.locationFromPosition(message.startPos, false); | 597 var location = message.script.locationFromPosition(message.startPos, false); |
598 if (location == null) return -1; | 598 if (location == null) return -1; |
599 location.restrict(); | 599 location.restrict(); |
600 return message.startPos - location.start; | 600 return message.startPos - location.start; |
601 } | 601 } |
602 | 602 |
603 | 603 |
604 function ErrorMessage(type, args, startPos, endPos, script, stackTrace) { | 604 function ErrorMessage(type, args, startPos, endPos, script, stackTrace, |
| 605 stackFrames) { |
605 this.startPos = startPos; | 606 this.startPos = startPos; |
606 this.endPos = endPos; | 607 this.endPos = endPos; |
607 this.type = type; | 608 this.type = type; |
608 this.args = args; | 609 this.args = args; |
609 this.script = script; | 610 this.script = script; |
610 this.stackTrace = stackTrace; | 611 this.stackTrace = stackTrace; |
| 612 this.stackFrames = stackFrames; |
611 } | 613 } |
612 | 614 |
613 | 615 |
614 function MakeMessage(type, args, startPos, endPos, script, stackTrace) { | 616 function MakeMessage(type, args, startPos, endPos, script, stackTrace, |
615 return new ErrorMessage(type, args, startPos, endPos, script, stackTrace); | 617 stackFrames) { |
| 618 return new ErrorMessage(type, args, startPos, endPos, script, stackTrace, |
| 619 stackFrames); |
616 } | 620 } |
617 | 621 |
618 | 622 |
619 function GetStackTraceLine(recv, fun, pos, isGlobal) { | 623 function GetStackTraceLine(recv, fun, pos, isGlobal) { |
620 return FormatSourcePosition(new CallSite(recv, fun, pos)); | 624 return FormatSourcePosition(new CallSite(recv, fun, pos)); |
621 } | 625 } |
622 | 626 |
623 // ---------------------------------------------------------------------------- | 627 // ---------------------------------------------------------------------------- |
624 // Error implementation | 628 // Error implementation |
625 | 629 |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
970 return this.name + ": " + FormatMessage({ type: type, args: this.arguments }
); | 974 return this.name + ": " + FormatMessage({ type: type, args: this.arguments }
); |
971 } | 975 } |
972 var message = this.message; | 976 var message = this.message; |
973 return this.name + (message ? (": " + message) : ""); | 977 return this.name + (message ? (": " + message) : ""); |
974 }, DONT_ENUM); | 978 }, DONT_ENUM); |
975 | 979 |
976 | 980 |
977 // Boilerplate for exceptions for stack overflows. Used from | 981 // Boilerplate for exceptions for stack overflows. Used from |
978 // Top::StackOverflow(). | 982 // Top::StackOverflow(). |
979 const kStackOverflowBoilerplate = MakeRangeError('stack_overflow', []); | 983 const kStackOverflowBoilerplate = MakeRangeError('stack_overflow', []); |
OLD | NEW |