OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
43 for (var i = 0; i < format.length; i++) { | 43 for (var i = 0; i < format.length; i++) { |
44 var str = format[i]; | 44 var str = format[i]; |
45 if (str.length == 2 && %_StringCharCodeAt(str, 0) == 0x25) { | 45 if (str.length == 2 && %_StringCharCodeAt(str, 0) == 0x25) { |
46 // Two-char string starts with "%". | 46 // Two-char string starts with "%". |
47 var arg_num = (%_StringCharCodeAt(str, 1) - 0x30) >>> 0; | 47 var arg_num = (%_StringCharCodeAt(str, 1) - 0x30) >>> 0; |
48 if (arg_num < 4) { | 48 if (arg_num < 4) { |
49 // str is one of %0, %1, %2 or %3. | 49 // str is one of %0, %1, %2 or %3. |
50 try { | 50 try { |
51 str = ToDetailString(args[arg_num]); | 51 str = ToDetailString(args[arg_num]); |
52 } catch (e) { | 52 } catch (e) { |
53 str = "#<error>"; | 53 if (%IsJSModule(args[arg_num])) |
54 str = "module"; | |
55 else if (IS_SPEC_OBJECT(args[arg_num])) | |
56 str = "object"; | |
57 else | |
58 str = "#<error>"; | |
54 } | 59 } |
55 } | 60 } |
56 } | 61 } |
57 result += str; | 62 result += str; |
58 } | 63 } |
59 return result; | 64 return result; |
60 } | 65 } |
61 | 66 |
62 | 67 |
63 // To check if something is a native error we need to check the | 68 // To check if something is a native error we need to check the |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
244 "strict_cannot_assign", ["Cannot assign to read only '", "%0", "' in strict mode"], | 249 "strict_cannot_assign", ["Cannot assign to read only '", "%0", "' in strict mode"], |
245 "strict_poison_pill", ["'caller', 'callee', and 'arguments' prop erties may not be accessed on strict mode functions or the arguments objects for calls to them"], | 250 "strict_poison_pill", ["'caller', 'callee', and 'arguments' prop erties may not be accessed on strict mode functions or the arguments objects for calls to them"], |
246 "strict_caller", ["Illegal access to a strict mode caller f unction."], | 251 "strict_caller", ["Illegal access to a strict mode caller f unction."], |
247 "unprotected_let", ["Illegal let declaration in unprotected s tatement context."], | 252 "unprotected_let", ["Illegal let declaration in unprotected s tatement context."], |
248 "unprotected_const", ["Illegal const declaration in unprotected statement context."], | 253 "unprotected_const", ["Illegal const declaration in unprotected statement context."], |
249 "cant_prevent_ext_external_array_elements", ["Cannot prevent extension of an object with external array elements"], | 254 "cant_prevent_ext_external_array_elements", ["Cannot prevent extension of an object with external array elements"], |
250 "redef_external_array_element", ["Cannot redefine a property of an object with external array elements"], | 255 "redef_external_array_element", ["Cannot redefine a property of an object with external array elements"], |
251 "harmony_const_assign", ["Assignment to constant variable."], | 256 "harmony_const_assign", ["Assignment to constant variable."], |
252 "invalid_module_path", ["Module does not export '", "%0", "', or export is not itself a module"], | 257 "invalid_module_path", ["Module does not export '", "%0", "', or export is not itself a module"], |
253 "module_type_error", ["Module '", "%0", "' used improperly"], | 258 "module_type_error", ["Module '", "%0", "' used improperly"], |
259 "export_undefined", ["Export '", "%0", "' is not defined in mo dule"], | |
Michael Starzinger
2012/07/06 10:53:22
Should we maybe name this "module_export_undefined
rossberg
2012/07/06 15:39:28
Done.
| |
254 ]; | 260 ]; |
255 var messages = { __proto__ : null }; | 261 var messages = { __proto__ : null }; |
256 for (var i = 0; i < messagesDictionary.length; i += 2) { | 262 for (var i = 0; i < messagesDictionary.length; i += 2) { |
257 var key = messagesDictionary[i]; | 263 var key = messagesDictionary[i]; |
258 var format = messagesDictionary[i + 1]; | 264 var format = messagesDictionary[i + 1]; |
259 | 265 |
260 for (var j = 0; j < format.length; j++) { | 266 for (var j = 0; j < format.length; j++) { |
261 %IgnoreAttributesAndSetProperty(format, %_NumberToString(j), format[j], | 267 %IgnoreAttributesAndSetProperty(format, %_NumberToString(j), format[j], |
262 DONT_DELETE | READ_ONLY | DONT_ENUM); | 268 DONT_DELETE | READ_ONLY | DONT_ENUM); |
263 } | 269 } |
(...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1253 throw e; | 1259 throw e; |
1254 } | 1260 } |
1255 } | 1261 } |
1256 | 1262 |
1257 | 1263 |
1258 InstallFunctions($Error.prototype, DONT_ENUM, ['toString', ErrorToString]); | 1264 InstallFunctions($Error.prototype, DONT_ENUM, ['toString', ErrorToString]); |
1259 | 1265 |
1260 // Boilerplate for exceptions for stack overflows. Used from | 1266 // Boilerplate for exceptions for stack overflows. Used from |
1261 // Isolate::StackOverflow(). | 1267 // Isolate::StackOverflow(). |
1262 var kStackOverflowBoilerplate = MakeRangeError('stack_overflow', []); | 1268 var kStackOverflowBoilerplate = MakeRangeError('stack_overflow', []); |
OLD | NEW |