Index: src/messages.js |
diff --git a/src/messages.js b/src/messages.js |
index 45784616c21e2a10c3d1199ee92fc71c77b4560c..9c8c075e9ee503a8217ddfe453d6c31c82343754 100644 |
--- a/src/messages.js |
+++ b/src/messages.js |
@@ -6,9 +6,12 @@ |
var kMessages = { |
// Error |
+ cyclic_proto: ["Cyclic __proto__ value"], |
+ code_gen_from_strings: ["%0"], |
constructor_is_generator: ["Class constructor may not be a generator"], |
constructor_is_accessor: ["Class constructor may not be an accessor"], |
// TypeError |
+ generator_running: ["Generator is already running"], |
unexpected_token: ["Unexpected token ", "%0"], |
unexpected_token_number: ["Unexpected number"], |
unexpected_token_string: ["Unexpected string"], |
@@ -24,6 +27,7 @@ |
unterminated_template_expr: ["Missing } in template expression"], |
unterminated_arg_list: ["missing ) after argument list"], |
regexp_flags: ["Cannot supply flags when constructing one RegExp from another"], |
+ incompatible_method_receiver: ["Method ", "%0", " called on incompatible receiver ", "%1"], |
multiple_defaults_in_switch: ["More than one default clause in switch statement"], |
newline_after_throw: ["Illegal newline after throw"], |
label_redeclaration: ["Label '", "%0", "' has already been declared"], |
@@ -32,6 +36,8 @@ |
no_catch_or_finally: ["Missing catch or finally after try"], |
unknown_label: ["Undefined label '", "%0", "'"], |
uncaught_exception: ["Uncaught ", "%0"], |
+ stack_trace: ["Stack Trace:\n", "%0"], |
+ called_non_callable: ["%0", " is not a function"], |
undefined_method: ["Object ", "%1", " has no method '", "%0", "'"], |
cannot_convert_to_primitive: ["Cannot convert object to primitive value"], |
not_constructor: ["%0", " is not a constructor"], |
@@ -311,8 +317,13 @@ |
} |
-function MakeGenericError(constructor, type, arg0, arg1, arg2) { |
- if (IS_UNDEFINED(arg0) && IS_STRING(type)) arg0 = []; |
+function MakeGenericError(constructor, type, args) { |
+ if (IS_UNDEFINED(args)) args = []; |
+ return new constructor(FormatMessage(type, args)); |
+} |
+ |
+ |
+function MakeGenericError2(constructor, type, arg0, arg1, arg2) { |
return new constructor(FormatMessage(type, arg0, arg1, arg2)); |
} |
@@ -369,34 +380,41 @@ |
} |
-function MakeError(type, arg0, arg1, arg2) { |
- return MakeGenericError($Error, type, arg0, arg1, arg2); |
-} |
- |
- |
-function MakeTypeError(type, arg0, arg1, arg2) { |
- return MakeGenericError($TypeError, type, arg0, arg1, arg2); |
-} |
- |
- |
-function MakeRangeError(type, arg0, arg1, arg2) { |
- return MakeGenericError($RangeError, type, arg0, arg1, arg2); |
-} |
- |
- |
-function MakeSyntaxError(type, arg0, arg1, arg2) { |
- return MakeGenericError($SyntaxError, type, arg0, arg1, arg2); |
-} |
- |
- |
-function MakeReferenceError(type, arg0, arg1, arg2) { |
- return MakeGenericError($ReferenceError, type, arg0, arg1, arg2); |
-} |
- |
- |
-function MakeEvalError(type, arg0, arg1, arg2) { |
- return MakeGenericError($EvalError, type, arg0, arg1, arg2); |
-} |
+function MakeTypeError(type, args) { |
+ return MakeGenericError($TypeError, type, args); |
+} |
+ |
+ |
+// TODO(yangguo): rename this once we migrated all messages. |
+function MakeTypeError2(type, arg0, arg1, arg2) { |
+ return MakeGenericError2($TypeError, type, arg0, arg1, arg2); |
+} |
+ |
+ |
+function MakeRangeError(type, args) { |
+ return MakeGenericError($RangeError, type, args); |
+} |
+ |
+ |
+function MakeSyntaxError(type, args) { |
+ return MakeGenericError($SyntaxError, type, args); |
+} |
+ |
+ |
+function MakeReferenceError(type, args) { |
+ return MakeGenericError($ReferenceError, type, args); |
+} |
+ |
+ |
+function MakeEvalError(type, args) { |
+ return MakeGenericError($EvalError, type, args); |
+} |
+ |
+ |
+function MakeError(type, args) { |
+ return MakeGenericError($Error, type, args); |
+} |
+ |
// The embedded versions are called from unoptimized code, with embedded |
// arguments. Those arguments cannot be arrays, which are context-dependent. |