OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 the V8 project authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 var $RegExp = global.RegExp; | |
6 | |
7 // ------------------------------------------------------------------- | |
8 | |
9 function ExtendRegExpPrototype() { | |
10 var NoOpSetter = function(ignored) {}; | |
11 | |
12 | |
13 // ES6 draft 12-06-13, section 21.2.5.3 | |
14 // + https://bugs.ecmascript.org/show_bug.cgi?id=3423 | |
15 var RegExpGetFlags = function() { | |
arv (Not doing code reviews)
2014/12/10 02:54:50
Move this out of ExtendRegExpPrototype.
| |
16 if (!IS_SPEC_OBJECT(this)) { | |
17 throw MakeTypeError('home_object_non_object', | |
Dmitry Lomov (no reviews)
2014/12/09 23:39:13
Wrong error message.
| |
18 'RegExp.prototype.flags', | |
19 [%ToString(this)]); | |
20 } | |
21 var result = ''; | |
22 if (this.global) result += 'g'; | |
23 if (this.ignoreCase) result += 'i'; | |
24 if (this.multiline) result += 'm'; | |
25 if (this.unicode) result += 'u'; | |
26 if (this.sticky) result += 'y'; | |
27 return result; | |
28 }; | |
29 | |
30 %DefineAccessorPropertyUnchecked($RegExp.prototype, 'flags', RegExpGetFlags, | |
Dmitry Lomov (no reviews)
2014/12/09 23:39:13
You should pass 'undefined' here instead of NoOpSe
| |
31 NoOpSetter, DONT_DELETE); | |
32 %SetNativeFlag(RegExpGetFlags); | |
33 } | |
34 | |
35 ExtendRegExpPrototype(); | |
OLD | NEW |