| Index: src/regexp.js
|
| ===================================================================
|
| --- src/regexp.js (revision 12582)
|
| +++ src/regexp.js (working copy)
|
| @@ -206,6 +206,47 @@
|
| }
|
|
|
|
|
| +function RegExpExecNoResult(string) {
|
| + if (!IS_REGEXP(this)) {
|
| + throw MakeTypeError('incompatible_method_receiver',
|
| + ['RegExp.prototype.exec', this]);
|
| + }
|
| +
|
| + if (%_ArgumentsLength() === 0) {
|
| + var regExpInput = LAST_INPUT(lastMatchInfo);
|
| + if (IS_UNDEFINED(regExpInput)) {
|
| + throw MakeError('no_input_to_regexp', [this]);
|
| + }
|
| + string = regExpInput;
|
| + }
|
| + string = TO_STRING_INLINE(string);
|
| + var lastIndex = this.lastIndex;
|
| +
|
| + // Conversion is required by the ES5 specification (RegExp.prototype.exec
|
| + // algorithm, step 5) even if the value is discarded for non-global RegExps.
|
| + var i = TO_INTEGER(lastIndex);
|
| +
|
| + var global = this.global;
|
| + if (global) {
|
| + if (i < 0 || i > string.length) {
|
| + this.lastIndex = 0;
|
| + return null;
|
| + }
|
| + } else {
|
| + i = 0;
|
| + }
|
| +
|
| + %_Log('regexp', 'regexp-exec,%0r,%1S,%2i', [this, string, lastIndex]);
|
| + // matchIndices is either null or the lastMatchInfo array.
|
| + var matchIndices = %_RegExpExec(this, string, i, lastMatchInfo);
|
| +
|
| + if (matchIndices === null) {
|
| + if (global) this.lastIndex = 0;
|
| + return null;
|
| + }
|
| +}
|
| +
|
| +
|
| // One-element cache for the simplified test regexp.
|
| var regexp_key;
|
| var regexp_val;
|
|
|