OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 (function(global, utils) { | 5 (function(global, utils) { |
6 | 6 |
7 %CheckIsBootstrapping(); | 7 %CheckIsBootstrapping(); |
8 | 8 |
9 // ------------------------------------------------------------------- | 9 // ------------------------------------------------------------------- |
10 // Imports | 10 // Imports |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 } | 293 } |
294 | 294 |
295 | 295 |
296 // ES6 21.2.5.11. | 296 // ES6 21.2.5.11. |
297 function RegExpSplit(string, limit) { | 297 function RegExpSplit(string, limit) { |
298 // TODO(yangguo): allow non-regexp receivers. | 298 // TODO(yangguo): allow non-regexp receivers. |
299 if (!IS_REGEXP(this)) { | 299 if (!IS_REGEXP(this)) { |
300 throw MakeTypeError(kIncompatibleMethodReceiver, | 300 throw MakeTypeError(kIncompatibleMethodReceiver, |
301 "RegExp.prototype.@@split", this); | 301 "RegExp.prototype.@@split", this); |
302 } | 302 } |
| 303 |
| 304 // TODO(yangguo): Clone the RegExp using SpeciesConstructor |
| 305 // to change the flags to turn 'y' on. |
| 306 |
303 var separator = this; | 307 var separator = this; |
304 var subject = TO_STRING(string); | 308 var subject = TO_STRING(string); |
305 | 309 |
306 limit = (IS_UNDEFINED(limit)) ? kMaxUint32 : TO_UINT32(limit); | 310 limit = (IS_UNDEFINED(limit)) ? kMaxUint32 : TO_UINT32(limit); |
307 var length = subject.length; | 311 var length = subject.length; |
308 | 312 |
309 if (limit === 0) return []; | 313 if (limit === 0) return []; |
310 | 314 |
311 if (length === 0) { | 315 if (length === 0) { |
312 if (DoRegExpExec(separator, subject, 0, 0) !== null) return []; | 316 if (DoRegExpExec(separator, subject, 0, 0) !== null) return []; |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 // Exports | 576 // Exports |
573 | 577 |
574 utils.Export(function(to) { | 578 utils.Export(function(to) { |
575 to.RegExpExec = DoRegExpExec; | 579 to.RegExpExec = DoRegExpExec; |
576 to.RegExpExecNoTests = RegExpExecNoTests; | 580 to.RegExpExecNoTests = RegExpExecNoTests; |
577 to.RegExpLastMatchInfo = RegExpLastMatchInfo; | 581 to.RegExpLastMatchInfo = RegExpLastMatchInfo; |
578 to.RegExpTest = RegExpTest; | 582 to.RegExpTest = RegExpTest; |
579 }); | 583 }); |
580 | 584 |
581 }) | 585 }) |
OLD | NEW |