| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 function FormatMessage(message) { | 144 function FormatMessage(message) { |
| 145 if (kMessages === 0) { | 145 if (kMessages === 0) { |
| 146 kMessages = { | 146 kMessages = { |
| 147 // Error | 147 // Error |
| 148 cyclic_proto: ["Cyclic __proto__ value"], | 148 cyclic_proto: ["Cyclic __proto__ value"], |
| 149 // TypeError | 149 // TypeError |
| 150 unexpected_token: ["Unexpected token ", "%0"], | 150 unexpected_token: ["Unexpected token ", "%0"], |
| 151 unexpected_token_number: ["Unexpected number"], | 151 unexpected_token_number: ["Unexpected number"], |
| 152 unexpected_token_string: ["Unexpected string"], | 152 unexpected_token_string: ["Unexpected string"], |
| 153 unexpected_token_identifier: ["Unexpected identifier"], | 153 unexpected_token_identifier: ["Unexpected identifier"], |
| 154 unexpected_strict_reserved: ["Unexpected strict mode reserved word"], |
| 154 unexpected_eos: ["Unexpected end of input"], | 155 unexpected_eos: ["Unexpected end of input"], |
| 155 malformed_regexp: ["Invalid regular expression: /", "%0", "/:
", "%1"], | 156 malformed_regexp: ["Invalid regular expression: /", "%0", "/:
", "%1"], |
| 156 unterminated_regexp: ["Invalid regular expression: missing /"], | 157 unterminated_regexp: ["Invalid regular expression: missing /"], |
| 157 regexp_flags: ["Cannot supply flags when constructing one
RegExp from another"], | 158 regexp_flags: ["Cannot supply flags when constructing one
RegExp from another"], |
| 158 incompatible_method_receiver: ["Method ", "%0", " called on incompatible r
eceiver ", "%1"], | 159 incompatible_method_receiver: ["Method ", "%0", " called on incompatible r
eceiver ", "%1"], |
| 159 invalid_lhs_in_assignment: ["Invalid left-hand side in assignment"], | 160 invalid_lhs_in_assignment: ["Invalid left-hand side in assignment"], |
| 160 invalid_lhs_in_for_in: ["Invalid left-hand side in for-in"], | 161 invalid_lhs_in_for_in: ["Invalid left-hand side in for-in"], |
| 161 invalid_lhs_in_postfix_op: ["Invalid left-hand side expression in postf
ix operation"], | 162 invalid_lhs_in_postfix_op: ["Invalid left-hand side expression in postf
ix operation"], |
| 162 invalid_lhs_in_prefix_op: ["Invalid left-hand side expression in prefi
x operation"], | 163 invalid_lhs_in_prefix_op: ["Invalid left-hand side expression in prefi
x operation"], |
| 163 multiple_defaults_in_switch: ["More than one default clause in switch sta
tement"], | 164 multiple_defaults_in_switch: ["More than one default clause in switch sta
tement"], |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 strict_param_dupe: ["Strict mode function may not have duplicat
e parameter names"], | 219 strict_param_dupe: ["Strict mode function may not have duplicat
e parameter names"], |
| 219 strict_var_name: ["Variable name may not be eval or arguments
in strict mode"], | 220 strict_var_name: ["Variable name may not be eval or arguments
in strict mode"], |
| 220 strict_function_name: ["Function name may not be eval or arguments
in strict mode"], | 221 strict_function_name: ["Function name may not be eval or arguments
in strict mode"], |
| 221 strict_octal_literal: ["Octal literals are not allowed in strict m
ode."], | 222 strict_octal_literal: ["Octal literals are not allowed in strict m
ode."], |
| 222 strict_duplicate_property: ["Duplicate data property in object literal
not allowed in strict mode"], | 223 strict_duplicate_property: ["Duplicate data property in object literal
not allowed in strict mode"], |
| 223 accessor_data_property: ["Object literal may not have data and acces
sor property with the same name"], | 224 accessor_data_property: ["Object literal may not have data and acces
sor property with the same name"], |
| 224 accessor_get_set: ["Object literal may not have multiple get/s
et accessors with the same name"], | 225 accessor_get_set: ["Object literal may not have multiple get/s
et accessors with the same name"], |
| 225 strict_lhs_assignment: ["Assignment to eval or arguments is not all
owed in strict mode"], | 226 strict_lhs_assignment: ["Assignment to eval or arguments is not all
owed in strict mode"], |
| 226 strict_lhs_postfix: ["Postfix increment/decrement may not have e
val or arguments operand in strict mode"], | 227 strict_lhs_postfix: ["Postfix increment/decrement may not have e
val or arguments operand in strict mode"], |
| 227 strict_lhs_prefix: ["Prefix increment/decrement may not have ev
al or arguments operand in strict mode"], | 228 strict_lhs_prefix: ["Prefix increment/decrement may not have ev
al or arguments operand in strict mode"], |
| 229 strict_reserved_word: ["Use of future reserved word in strict mode
"], |
| 228 }; | 230 }; |
| 229 } | 231 } |
| 230 var format = kMessages[message.type]; | 232 var format = kMessages[message.type]; |
| 231 if (!format) return "<unknown message " + message.type + ">"; | 233 if (!format) return "<unknown message " + message.type + ">"; |
| 232 return FormatString(format, message.args); | 234 return FormatString(format, message.args); |
| 233 } | 235 } |
| 234 | 236 |
| 235 | 237 |
| 236 function GetLineNumber(message) { | 238 function GetLineNumber(message) { |
| 237 if (message.startPos == -1) return kNoLineNumberInfo; | 239 if (message.startPos == -1) return kNoLineNumberInfo; |
| (...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1067 else throw e; | 1069 else throw e; |
| 1068 } | 1070 } |
| 1069 } | 1071 } |
| 1070 | 1072 |
| 1071 %FunctionSetName(errorToString, 'toString'); | 1073 %FunctionSetName(errorToString, 'toString'); |
| 1072 %SetProperty($Error.prototype, 'toString', errorToString, DONT_ENUM); | 1074 %SetProperty($Error.prototype, 'toString', errorToString, DONT_ENUM); |
| 1073 | 1075 |
| 1074 // Boilerplate for exceptions for stack overflows. Used from | 1076 // Boilerplate for exceptions for stack overflows. Used from |
| 1075 // Top::StackOverflow(). | 1077 // Top::StackOverflow(). |
| 1076 const kStackOverflowBoilerplate = MakeRangeError('stack_overflow', []); | 1078 const kStackOverflowBoilerplate = MakeRangeError('stack_overflow', []); |
| OLD | NEW |