| OLD | NEW |
| 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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 } | 218 } |
| 219 | 219 |
| 220 %_Log('regexp', 'regexp-exec,%0r,%1S,%2i', [this, s, lastIndex]); | 220 %_Log('regexp', 'regexp-exec,%0r,%1S,%2i', [this, s, lastIndex]); |
| 221 // matchIndices is either null or the lastMatchInfo array. | 221 // matchIndices is either null or the lastMatchInfo array. |
| 222 var matchIndices = %RegExpExec(this, s, i, lastMatchInfo); | 222 var matchIndices = %RegExpExec(this, s, i, lastMatchInfo); |
| 223 | 223 |
| 224 if (matchIndices == null) { | 224 if (matchIndices == null) { |
| 225 if (this.global) this.lastIndex = 0; | 225 if (this.global) this.lastIndex = 0; |
| 226 return false; | 226 return false; |
| 227 } | 227 } |
| 228 |
| 229 if (this.global) this.lastIndex = lastMatchInfo[CAPTURE1]; |
| 228 return true; | 230 return true; |
| 229 } | 231 } |
| 230 | 232 |
| 231 | 233 |
| 232 function RegExpToString() { | 234 function RegExpToString() { |
| 233 // If this.source is an empty string, output /(?:)/. | 235 // If this.source is an empty string, output /(?:)/. |
| 234 // http://bugzilla.mozilla.org/show_bug.cgi?id=225550 | 236 // http://bugzilla.mozilla.org/show_bug.cgi?id=225550 |
| 235 // ecma_2/RegExp/properties-001.js. | 237 // ecma_2/RegExp/properties-001.js. |
| 236 var src = this.source ? this.source : '(?:)'; | 238 var src = this.source ? this.source : '(?:)'; |
| 237 var result = '/' + src + '/'; | 239 var result = '/' + src + '/'; |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 %DefineAccessor($RegExp, "$'", SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE); | 397 %DefineAccessor($RegExp, "$'", SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE); |
| 396 | 398 |
| 397 for (var i = 1; i < 10; ++i) { | 399 for (var i = 1; i < 10; ++i) { |
| 398 %DefineAccessor($RegExp, '$' + i, GETTER, RegExpMakeCaptureGetter(i), DONT_D
ELETE); | 400 %DefineAccessor($RegExp, '$' + i, GETTER, RegExpMakeCaptureGetter(i), DONT_D
ELETE); |
| 399 %DefineAccessor($RegExp, '$' + i, SETTER, NoOpSetter, DONT_DELETE); | 401 %DefineAccessor($RegExp, '$' + i, SETTER, NoOpSetter, DONT_DELETE); |
| 400 } | 402 } |
| 401 } | 403 } |
| 402 | 404 |
| 403 | 405 |
| 404 SetupRegExp(); | 406 SetupRegExp(); |
| OLD | NEW |