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

Side by Side Diff: src/regexp-delay.js

Issue 660178: Add missing error message for calling functions on incompatible receivers. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « src/messages.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 } 135 }
136 136
137 137
138 function DoRegExpExec(regexp, string, index) { 138 function DoRegExpExec(regexp, string, index) {
139 return %_RegExpExec(regexp, string, index, lastMatchInfo); 139 return %_RegExpExec(regexp, string, index, lastMatchInfo);
140 } 140 }
141 141
142 142
143 function RegExpExec(string) { 143 function RegExpExec(string) {
144 if (!IS_REGEXP(this)) { 144 if (!IS_REGEXP(this)) {
145 throw MakeTypeError('method_called_on_incompatible', 145 throw MakeTypeError('incompatible_method_receiver',
146 ['RegExp.prototype.exec', this]); 146 ['RegExp.prototype.exec', this]);
147 } 147 }
148 if (%_ArgumentsLength() == 0) { 148 if (%_ArgumentsLength() == 0) {
149 var regExpInput = LAST_INPUT(lastMatchInfo); 149 var regExpInput = LAST_INPUT(lastMatchInfo);
150 if (IS_UNDEFINED(regExpInput)) { 150 if (IS_UNDEFINED(regExpInput)) {
151 throw MakeError('no_input_to_regexp', [this]); 151 throw MakeError('no_input_to_regexp', [this]);
152 } 152 }
153 string = regExpInput; 153 string = regExpInput;
154 } 154 }
155 var s = ToString(string); 155 var s = ToString(string);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 return result; 192 return result;
193 } 193 }
194 194
195 195
196 // Section 15.10.6.3 doesn't actually make sense, but the intention seems to be 196 // Section 15.10.6.3 doesn't actually make sense, but the intention seems to be
197 // that test is defined in terms of String.prototype.exec. However, it probably 197 // that test is defined in terms of String.prototype.exec. However, it probably
198 // means the original value of String.prototype.exec, which is what everybody 198 // means the original value of String.prototype.exec, which is what everybody
199 // else implements. 199 // else implements.
200 function RegExpTest(string) { 200 function RegExpTest(string) {
201 if (!IS_REGEXP(this)) { 201 if (!IS_REGEXP(this)) {
202 throw MakeTypeError('method_called_on_incompatible', 202 throw MakeTypeError('incompatible_method_receiver',
203 ['RegExp.prototype.test', this]); 203 ['RegExp.prototype.test', this]);
204 } 204 }
205 if (%_ArgumentsLength() == 0) { 205 if (%_ArgumentsLength() == 0) {
206 var regExpInput = LAST_INPUT(lastMatchInfo); 206 var regExpInput = LAST_INPUT(lastMatchInfo);
207 if (IS_UNDEFINED(regExpInput)) { 207 if (IS_UNDEFINED(regExpInput)) {
208 throw MakeError('no_input_to_regexp', [this]); 208 throw MakeError('no_input_to_regexp', [this]);
209 } 209 }
210 string = regExpInput; 210 string = regExpInput;
211 } 211 }
212 var s = ToString(string); 212 var s = ToString(string);
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 %DefineAccessor($RegExp, "$'", SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE); 397 %DefineAccessor($RegExp, "$'", SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE);
398 398
399 for (var i = 1; i < 10; ++i) { 399 for (var i = 1; i < 10; ++i) {
400 %DefineAccessor($RegExp, '$' + i, GETTER, RegExpMakeCaptureGetter(i), DONT_D ELETE); 400 %DefineAccessor($RegExp, '$' + i, GETTER, RegExpMakeCaptureGetter(i), DONT_D ELETE);
401 %DefineAccessor($RegExp, '$' + i, SETTER, NoOpSetter, DONT_DELETE); 401 %DefineAccessor($RegExp, '$' + i, SETTER, NoOpSetter, DONT_DELETE);
402 } 402 }
403 } 403 }
404 404
405 405
406 SetupRegExp(); 406 SetupRegExp();
OLDNEW
« no previous file with comments | « src/messages.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698