| 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 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 // Matches Script::CompilationType from objects.h | 36 // Matches Script::CompilationType from objects.h |
| 37 var COMPILATION_TYPE_HOST = 0; | 37 var COMPILATION_TYPE_HOST = 0; |
| 38 var COMPILATION_TYPE_EVAL = 1; | 38 var COMPILATION_TYPE_EVAL = 1; |
| 39 var COMPILATION_TYPE_JSON = 2; | 39 var COMPILATION_TYPE_JSON = 2; |
| 40 | 40 |
| 41 // Lazily initialized. | 41 // Lazily initialized. |
| 42 var kVowelSounds = 0; | 42 var kVowelSounds = 0; |
| 43 var kCapitalVowelSounds = 0; | 43 var kCapitalVowelSounds = 0; |
| 44 | 44 |
| 45 // Matches Messages::kNoLineNumberInfo from v8.h |
| 46 var kNoLineNumberInfo = 0; |
| 47 |
| 45 // If this object gets passed to an error constructor the error will | 48 // If this object gets passed to an error constructor the error will |
| 46 // get an accessor for .message that constructs a descriptive error | 49 // get an accessor for .message that constructs a descriptive error |
| 47 // message on access. | 50 // message on access. |
| 48 var kAddMessageAccessorsMarker = { }; | 51 var kAddMessageAccessorsMarker = { }; |
| 49 | 52 |
| 50 | 53 |
| 51 function GetInstanceName(cons) { | 54 function GetInstanceName(cons) { |
| 52 if (cons.length == 0) { | 55 if (cons.length == 0) { |
| 53 return ""; | 56 return ""; |
| 54 } | 57 } |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 illegal_access: "illegal access" | 199 illegal_access: "illegal access" |
| 197 }; | 200 }; |
| 198 } | 201 } |
| 199 var format = kMessages[message.type]; | 202 var format = kMessages[message.type]; |
| 200 if (!format) return "<unknown message " + message.type + ">"; | 203 if (!format) return "<unknown message " + message.type + ">"; |
| 201 return FormatString(format, message.args); | 204 return FormatString(format, message.args); |
| 202 } | 205 } |
| 203 | 206 |
| 204 | 207 |
| 205 function GetLineNumber(message) { | 208 function GetLineNumber(message) { |
| 206 if (message.startPos == -1) return -1; | 209 if (message.startPos == -1) return kNoLineNumberInfo; |
| 207 var location = message.script.locationFromPosition(message.startPos, true); | 210 var location = message.script.locationFromPosition(message.startPos, true); |
| 208 if (location == null) return -1; | 211 if (location == null) return kNoLineNumberInfo; |
| 209 return location.line + 1; | 212 return location.line + 1; |
| 210 } | 213 } |
| 211 | 214 |
| 212 | 215 |
| 213 // Returns the source code line containing the given source | 216 // Returns the source code line containing the given source |
| 214 // position, or the empty string if the position is invalid. | 217 // position, or the empty string if the position is invalid. |
| 215 function GetSourceLine(message) { | 218 function GetSourceLine(message) { |
| 216 var location = message.script.locationFromPosition(message.startPos, true); | 219 var location = message.script.locationFromPosition(message.startPos, true); |
| 217 if (location == null) return ""; | 220 if (location == null) return ""; |
| 218 location.restrict(); | 221 location.restrict(); |
| (...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 965 return this.name + ": " + FormatMessage({ type: type, args: this.arguments }
); | 968 return this.name + ": " + FormatMessage({ type: type, args: this.arguments }
); |
| 966 } | 969 } |
| 967 var message = this.message; | 970 var message = this.message; |
| 968 return this.name + (message ? (": " + message) : ""); | 971 return this.name + (message ? (": " + message) : ""); |
| 969 }, DONT_ENUM); | 972 }, DONT_ENUM); |
| 970 | 973 |
| 971 | 974 |
| 972 // Boilerplate for exceptions for stack overflows. Used from | 975 // Boilerplate for exceptions for stack overflows. Used from |
| 973 // Top::StackOverflow(). | 976 // Top::StackOverflow(). |
| 974 const kStackOverflowBoilerplate = MakeRangeError('stack_overflow', []); | 977 const kStackOverflowBoilerplate = MakeRangeError('stack_overflow', []); |
| OLD | NEW |