Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Side by Side Diff: src/messages.js

Issue 1095573002: Revert of Migrate error messages, part 2. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/messages.h ('k') | src/objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 kMessages = { 7 var kMessages = {
8 // Error 8 // Error
9 cyclic_proto: ["Cyclic __proto__ value"],
10 code_gen_from_strings: ["%0"],
9 constructor_is_generator: ["Class constructor may not be a generator"], 11 constructor_is_generator: ["Class constructor may not be a generator"],
10 constructor_is_accessor: ["Class constructor may not be an accessor"], 12 constructor_is_accessor: ["Class constructor may not be an accessor"],
11 // TypeError 13 // TypeError
14 generator_running: ["Generator is already running"],
12 unexpected_token: ["Unexpected token ", "%0"], 15 unexpected_token: ["Unexpected token ", "%0"],
13 unexpected_token_number: ["Unexpected number"], 16 unexpected_token_number: ["Unexpected number"],
14 unexpected_token_string: ["Unexpected string"], 17 unexpected_token_string: ["Unexpected string"],
15 unexpected_token_identifier: ["Unexpected identifier"], 18 unexpected_token_identifier: ["Unexpected identifier"],
16 unexpected_reserved: ["Unexpected reserved word"], 19 unexpected_reserved: ["Unexpected reserved word"],
17 unexpected_strict_reserved: ["Unexpected strict mode reserved word"], 20 unexpected_strict_reserved: ["Unexpected strict mode reserved word"],
18 unexpected_eos: ["Unexpected end of input"], 21 unexpected_eos: ["Unexpected end of input"],
19 unexpected_template_string: ["Unexpected template string"], 22 unexpected_template_string: ["Unexpected template string"],
20 malformed_regexp: ["Invalid regular expression: /", "%0", "/: ", "%1"], 23 malformed_regexp: ["Invalid regular expression: /", "%0", "/: ", "%1"],
21 malformed_regexp_flags: ["Invalid regular expression flags"], 24 malformed_regexp_flags: ["Invalid regular expression flags"],
22 unterminated_regexp: ["Invalid regular expression: missing /"], 25 unterminated_regexp: ["Invalid regular expression: missing /"],
23 unterminated_template: ["Unterminated template literal"], 26 unterminated_template: ["Unterminated template literal"],
24 unterminated_template_expr: ["Missing } in template expression"], 27 unterminated_template_expr: ["Missing } in template expression"],
25 unterminated_arg_list: ["missing ) after argument list"], 28 unterminated_arg_list: ["missing ) after argument list"],
26 regexp_flags: ["Cannot supply flags when constructing one Reg Exp from another"], 29 regexp_flags: ["Cannot supply flags when constructing one Reg Exp from another"],
30 incompatible_method_receiver: ["Method ", "%0", " called on incompatible rece iver ", "%1"],
27 multiple_defaults_in_switch: ["More than one default clause in switch statem ent"], 31 multiple_defaults_in_switch: ["More than one default clause in switch statem ent"],
28 newline_after_throw: ["Illegal newline after throw"], 32 newline_after_throw: ["Illegal newline after throw"],
29 label_redeclaration: ["Label '", "%0", "' has already been declared" ], 33 label_redeclaration: ["Label '", "%0", "' has already been declared" ],
30 var_redeclaration: ["Identifier '", "%0", "' has already been decl ared"], 34 var_redeclaration: ["Identifier '", "%0", "' has already been decl ared"],
31 duplicate_template_property: ["Object template has duplicate property '", "% 0", "'"], 35 duplicate_template_property: ["Object template has duplicate property '", "% 0", "'"],
32 no_catch_or_finally: ["Missing catch or finally after try"], 36 no_catch_or_finally: ["Missing catch or finally after try"],
33 unknown_label: ["Undefined label '", "%0", "'"], 37 unknown_label: ["Undefined label '", "%0", "'"],
34 uncaught_exception: ["Uncaught ", "%0"], 38 uncaught_exception: ["Uncaught ", "%0"],
39 stack_trace: ["Stack Trace:\n", "%0"],
40 called_non_callable: ["%0", " is not a function"],
35 undefined_method: ["Object ", "%1", " has no method '", "%0", "'" ], 41 undefined_method: ["Object ", "%1", " has no method '", "%0", "'" ],
36 cannot_convert_to_primitive: ["Cannot convert object to primitive value"], 42 cannot_convert_to_primitive: ["Cannot convert object to primitive value"],
37 not_constructor: ["%0", " is not a constructor"], 43 not_constructor: ["%0", " is not a constructor"],
38 not_defined: ["%0", " is not defined"], 44 not_defined: ["%0", " is not defined"],
39 non_method: ["'super' is referenced from non-method"], 45 non_method: ["'super' is referenced from non-method"],
40 unsupported_super: ["Unsupported reference to 'super'"], 46 unsupported_super: ["Unsupported reference to 'super'"],
41 non_object_property_load: ["Cannot read property '", "%0", "' of ", "%1"] , 47 non_object_property_load: ["Cannot read property '", "%0", "' of ", "%1"] ,
42 non_object_property_store: ["Cannot set property '", "%0", "' of ", "%1"], 48 non_object_property_store: ["Cannot set property '", "%0", "' of ", "%1"],
43 illegal_invocation: ["Illegal invocation"], 49 illegal_invocation: ["Illegal invocation"],
44 no_setter_in_callback: ["Cannot set property ", "%0", " of ", "%1", " which has only a getter"], 50 no_setter_in_callback: ["Cannot set property ", "%0", " of ", "%1", " which has only a getter"],
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 var constructorName = constructor.name; 310 var constructorName = constructor.name;
305 if (IS_STRING(constructorName) && constructorName !== "") { 311 if (IS_STRING(constructorName) && constructorName !== "") {
306 return "#<" + constructorName + ">"; 312 return "#<" + constructorName + ">";
307 } 313 }
308 } 314 }
309 } 315 }
310 return ToStringCheckErrorObject(obj); 316 return ToStringCheckErrorObject(obj);
311 } 317 }
312 318
313 319
314 function MakeGenericError(constructor, type, arg0, arg1, arg2) { 320 function MakeGenericError(constructor, type, args) {
315 if (IS_UNDEFINED(arg0) && IS_STRING(type)) arg0 = []; 321 if (IS_UNDEFINED(args)) args = [];
322 return new constructor(FormatMessage(type, args));
323 }
324
325
326 function MakeGenericError2(constructor, type, arg0, arg1, arg2) {
316 return new constructor(FormatMessage(type, arg0, arg1, arg2)); 327 return new constructor(FormatMessage(type, arg0, arg1, arg2));
317 } 328 }
318 329
319 330
320 /** 331 /**
321 * Set up the Script function and constructor. 332 * Set up the Script function and constructor.
322 */ 333 */
323 %FunctionSetInstanceClassName(Script, 'Script'); 334 %FunctionSetInstanceClassName(Script, 'Script');
324 %AddNamedProperty(Script.prototype, 'constructor', Script, 335 %AddNamedProperty(Script.prototype, 'constructor', Script,
325 DONT_ENUM | DONT_DELETE | READ_ONLY); 336 DONT_ENUM | DONT_DELETE | READ_ONLY);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 // position, or the empty string if the position is invalid. 373 // position, or the empty string if the position is invalid.
363 function GetSourceLine(message) { 374 function GetSourceLine(message) {
364 var script = %MessageGetScript(message); 375 var script = %MessageGetScript(message);
365 var start_position = %MessageGetStartPosition(message); 376 var start_position = %MessageGetStartPosition(message);
366 var location = script.locationFromPosition(start_position, true); 377 var location = script.locationFromPosition(start_position, true);
367 if (location == null) return ""; 378 if (location == null) return "";
368 return location.sourceText(); 379 return location.sourceText();
369 } 380 }
370 381
371 382
372 function MakeError(type, arg0, arg1, arg2) { 383 function MakeTypeError(type, args) {
373 return MakeGenericError($Error, type, arg0, arg1, arg2); 384 return MakeGenericError($TypeError, type, args);
374 } 385 }
375 386
376 387
377 function MakeTypeError(type, arg0, arg1, arg2) { 388 // TODO(yangguo): rename this once we migrated all messages.
378 return MakeGenericError($TypeError, type, arg0, arg1, arg2); 389 function MakeTypeError2(type, arg0, arg1, arg2) {
390 return MakeGenericError2($TypeError, type, arg0, arg1, arg2);
379 } 391 }
380 392
381 393
382 function MakeRangeError(type, arg0, arg1, arg2) { 394 function MakeRangeError(type, args) {
383 return MakeGenericError($RangeError, type, arg0, arg1, arg2); 395 return MakeGenericError($RangeError, type, args);
384 } 396 }
385 397
386 398
387 function MakeSyntaxError(type, arg0, arg1, arg2) { 399 function MakeSyntaxError(type, args) {
388 return MakeGenericError($SyntaxError, type, arg0, arg1, arg2); 400 return MakeGenericError($SyntaxError, type, args);
389 } 401 }
390 402
391 403
392 function MakeReferenceError(type, arg0, arg1, arg2) { 404 function MakeReferenceError(type, args) {
393 return MakeGenericError($ReferenceError, type, arg0, arg1, arg2); 405 return MakeGenericError($ReferenceError, type, args);
394 } 406 }
395 407
396 408
397 function MakeEvalError(type, arg0, arg1, arg2) { 409 function MakeEvalError(type, args) {
398 return MakeGenericError($EvalError, type, arg0, arg1, arg2); 410 return MakeGenericError($EvalError, type, args);
399 } 411 }
400 412
413
414 function MakeError(type, args) {
415 return MakeGenericError($Error, type, args);
416 }
417
418
401 // The embedded versions are called from unoptimized code, with embedded 419 // The embedded versions are called from unoptimized code, with embedded
402 // arguments. Those arguments cannot be arrays, which are context-dependent. 420 // arguments. Those arguments cannot be arrays, which are context-dependent.
403 function MakeTypeErrorEmbedded(type, arg) { 421 function MakeTypeErrorEmbedded(type, arg) {
404 return MakeGenericError($TypeError, type, [arg]); 422 return MakeGenericError($TypeError, type, [arg]);
405 } 423 }
406 424
407 425
408 function MakeSyntaxErrorEmbedded(type, arg) { 426 function MakeSyntaxErrorEmbedded(type, arg) {
409 return MakeGenericError($SyntaxError, type, [arg]); 427 return MakeGenericError($SyntaxError, type, [arg]);
410 } 428 }
(...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after
1292 function SetUpStackOverflowBoilerplate() { 1310 function SetUpStackOverflowBoilerplate() {
1293 var boilerplate = MakeRangeError('stack_overflow', []); 1311 var boilerplate = MakeRangeError('stack_overflow', []);
1294 1312
1295 %DefineAccessorPropertyUnchecked( 1313 %DefineAccessorPropertyUnchecked(
1296 boilerplate, 'stack', StackTraceGetter, StackTraceSetter, DONT_ENUM); 1314 boilerplate, 'stack', StackTraceGetter, StackTraceSetter, DONT_ENUM);
1297 1315
1298 return boilerplate; 1316 return boilerplate;
1299 } 1317 }
1300 1318
1301 var kStackOverflowBoilerplate = SetUpStackOverflowBoilerplate(); 1319 var kStackOverflowBoilerplate = SetUpStackOverflowBoilerplate();
OLDNEW
« no previous file with comments | « src/messages.h ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698