| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 var matchIndices = %RegExpExecGlobal(regexp, string); | 153 var matchIndices = %RegExpExecGlobal(regexp, string); |
| 154 if (matchIndices.length != 0) { | 154 if (matchIndices.length != 0) { |
| 155 regExpCaptures = matchIndices[matchIndices.length - 1]; | 155 regExpCaptures = matchIndices[matchIndices.length - 1]; |
| 156 regExpSubject = regExpInput = string; | 156 regExpSubject = regExpInput = string; |
| 157 } | 157 } |
| 158 return matchIndices; | 158 return matchIndices; |
| 159 } | 159 } |
| 160 | 160 |
| 161 | 161 |
| 162 function RegExpExec(string) { | 162 function RegExpExec(string) { |
| 163 if (!IS_REGEXP(this)) { |
| 164 throw MakeTypeError('method_called_on_incompatible', ['RegExp.prototype.exec
', this]); |
| 165 } |
| 163 if (%_ArgumentsLength() == 0) { | 166 if (%_ArgumentsLength() == 0) { |
| 164 if (IS_UNDEFINED(regExpInput)) { | 167 if (IS_UNDEFINED(regExpInput)) { |
| 165 throw MakeError('no_input_to_regexp', [this]); | 168 throw MakeError('no_input_to_regexp', [this]); |
| 166 } | 169 } |
| 167 string = regExpInput; | 170 string = regExpInput; |
| 168 } | 171 } |
| 169 var s = ToString(string); | 172 var s = ToString(string); |
| 170 var length = s.length; | 173 var length = s.length; |
| 171 var lastIndex = this.lastIndex; | 174 var lastIndex = this.lastIndex; |
| 172 var i = this.global ? TO_INTEGER(lastIndex) : 0; | 175 var i = this.global ? TO_INTEGER(lastIndex) : 0; |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 %DefineAccessor($RegExp, "$'", SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE); | 363 %DefineAccessor($RegExp, "$'", SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE); |
| 361 | 364 |
| 362 for (var i = 1; i < 10; ++i) { | 365 for (var i = 1; i < 10; ++i) { |
| 363 %DefineAccessor($RegExp, '$' + i, GETTER, RegExpMakeCaptureGetter(i), DONT_D
ELETE); | 366 %DefineAccessor($RegExp, '$' + i, GETTER, RegExpMakeCaptureGetter(i), DONT_D
ELETE); |
| 364 %DefineAccessor($RegExp, '$' + i, SETTER, NoOpSetter, DONT_DELETE); | 367 %DefineAccessor($RegExp, '$' + i, SETTER, NoOpSetter, DONT_DELETE); |
| 365 } | 368 } |
| 366 } | 369 } |
| 367 | 370 |
| 368 | 371 |
| 369 SetupRegExp(); | 372 SetupRegExp(); |
| OLD | NEW |