Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 294 %FunctionSetPrototype($RegExp, new $Object()); | 294 %FunctionSetPrototype($RegExp, new $Object()); |
| 295 %SetProperty($RegExp.prototype, 'constructor', $RegExp, DONT_ENUM); | 295 %SetProperty($RegExp.prototype, 'constructor', $RegExp, DONT_ENUM); |
| 296 %SetCode($RegExp, RegExpConstructor); | 296 %SetCode($RegExp, RegExpConstructor); |
| 297 | 297 |
| 298 InstallFunctions($RegExp.prototype, DONT_ENUM, $Array( | 298 InstallFunctions($RegExp.prototype, DONT_ENUM, $Array( |
| 299 "exec", RegExpExec, | 299 "exec", RegExpExec, |
| 300 "test", RegExpTest, | 300 "test", RegExpTest, |
| 301 "toString", RegExpToString, | 301 "toString", RegExpToString, |
| 302 "compile", CompileRegExp | 302 "compile", CompileRegExp |
| 303 )); | 303 )); |
| 304 | 304 |
|
Lasse Reichstein
2009/03/10 07:25:03
Was the comment wrong, or has Firefox changed to 1
Christian Plesner Hansen
2009/03/10 07:46:52
The comment was wrong in the sense that the spec d
| |
| 305 // The spec says nothing about the length of exec and test, but | |
| 306 // SpiderMonkey and KJS have length equal to 0. | |
| 307 %FunctionSetLength($RegExp.prototype.exec, 0); | |
| 308 %FunctionSetLength($RegExp.prototype.test, 0); | |
| 309 // The length of compile is 1 in SpiderMonkey. | 305 // The length of compile is 1 in SpiderMonkey. |
| 310 %FunctionSetLength($RegExp.prototype.compile, 1); | 306 %FunctionSetLength($RegExp.prototype.compile, 1); |
| 311 | 307 |
| 312 // The properties input, $input, and $_ are aliases for each other. When this | 308 // The properties input, $input, and $_ are aliases for each other. When this |
| 313 // value is set the value it is set to is coerced to a string. | 309 // value is set the value it is set to is coerced to a string. |
| 314 // Getter and setter for the input. | 310 // Getter and setter for the input. |
| 315 function RegExpGetInput() { | 311 function RegExpGetInput() { |
| 316 return IS_UNDEFINED(regExpInput) ? "" : regExpInput; | 312 return IS_UNDEFINED(regExpInput) ? "" : regExpInput; |
| 317 } | 313 } |
| 318 function RegExpSetInput(string) { regExpInput = ToString(string); } | 314 function RegExpSetInput(string) { regExpInput = ToString(string); } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 364 %DefineAccessor($RegExp, "$'", SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE); | 360 %DefineAccessor($RegExp, "$'", SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE); |
| 365 | 361 |
| 366 for (var i = 1; i < 10; ++i) { | 362 for (var i = 1; i < 10; ++i) { |
| 367 %DefineAccessor($RegExp, '$' + i, GETTER, RegExpMakeCaptureGetter(i), DONT_D ELETE); | 363 %DefineAccessor($RegExp, '$' + i, GETTER, RegExpMakeCaptureGetter(i), DONT_D ELETE); |
| 368 %DefineAccessor($RegExp, '$' + i, SETTER, NoOpSetter, DONT_DELETE); | 364 %DefineAccessor($RegExp, '$' + i, SETTER, NoOpSetter, DONT_DELETE); |
| 369 } | 365 } |
| 370 } | 366 } |
| 371 | 367 |
| 372 | 368 |
| 373 SetupRegExp(); | 369 SetupRegExp(); |
| OLD | NEW |