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 | |
Dmitry Lomov (no reviews)
2014/12/10 16:06:29
style nit: 'use strict'
| |
5 var $RegExp = global.RegExp; | |
6 | |
7 // ------------------------------------------------------------------- | |
8 | |
9 // ES6 draft 12-06-13, section 21.2.5.3 | |
10 // + https://bugs.ecmascript.org/show_bug.cgi?id=3423 | |
11 var RegExpGetFlags = function() { | |
Dmitry Lomov (no reviews)
2014/12/10 16:06:29
style nit: just use function RegExpGetFlags here.
| |
12 if (!IS_SPEC_OBJECT(this)) { | |
13 throw MakeTypeError('flags_getter_non_object', | |
14 [%ToString(this)]); | |
15 } | |
16 var result = ''; | |
17 if (this.global) result += 'g'; | |
18 if (this.ignoreCase) result += 'i'; | |
19 if (this.multiline) result += 'm'; | |
20 if (this.unicode) result += 'u'; | |
21 if (this.sticky) result += 'y'; | |
22 return result; | |
23 }; | |
24 | |
25 function ExtendRegExpPrototype() { | |
26 %CheckIsBootstrapping(); | |
27 | |
28 %DefineAccessorPropertyUnchecked($RegExp.prototype, 'flags', RegExpGetFlags, | |
29 null, DONT_ENUM | DONT_DELETE); | |
30 %SetNativeFlag(RegExpGetFlags); | |
31 } | |
32 | |
33 ExtendRegExpPrototype(); | |
OLD | NEW |