Reviewers: Vitaly,

Description:
Add missing error message for calling functions on incompatible receivers.

Please review this at http://codereview.chromium.org/660178

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
  M     src/messages.js
  M     src/regexp-delay.js


Index: src/regexp-delay.js
===================================================================
--- src/regexp-delay.js (revision 3960)
+++ src/regexp-delay.js (working copy)
@@ -142,7 +142,7 @@

 function RegExpExec(string) {
   if (!IS_REGEXP(this)) {
-    throw MakeTypeError('method_called_on_incompatible',
+    throw MakeTypeError('incompatible_method_receiver',
                         ['RegExp.prototype.exec', this]);
   }
   if (%_ArgumentsLength() == 0) {
@@ -199,7 +199,7 @@
 // else implements.
 function RegExpTest(string) {
   if (!IS_REGEXP(this)) {
-    throw MakeTypeError('method_called_on_incompatible',
+    throw MakeTypeError('incompatible_method_receiver',
                         ['RegExp.prototype.test', this]);
   }
   if (%_ArgumentsLength() == 0) {
Index: src/messages.js
===================================================================
--- src/messages.js     (revision 3960)
+++ src/messages.js     (working copy)
@@ -127,6 +127,7 @@
       malformed_regexp:             "Invalid regular expression: /%0/: %1",
unterminated_regexp: "Invalid regular expression: missing /", regexp_flags: "Cannot supply flags when constructing one RegExp from another", + incompatible_method_receiver: "Method %0 called on incompatible receiver %1",
       invalid_lhs_in_assignment:    "Invalid left-hand side in assignment",
       invalid_lhs_in_for_in:        "Invalid left-hand side in for-in",
invalid_lhs_in_postfix_op: "Invalid left-hand side expression in postfix operation",


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to