OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 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 | 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, exports) { | 5 (function(global, shared, exports) { |
6 | 6 |
7 'use strict'; | 7 'use strict'; |
8 | 8 |
9 %CheckIsBootstrapping(); | 9 %CheckIsBootstrapping(); |
10 | 10 |
11 var GlobalRegExp = global.RegExp; | 11 var GlobalRegExp = global.RegExp; |
12 | 12 |
13 // ------------------------------------------------------------------- | 13 // ------------------------------------------------------------------- |
14 | 14 |
15 // ES6 draft 12-06-13, section 21.2.5.3 | 15 // ES6 draft 12-06-13, section 21.2.5.3 |
16 // + https://bugs.ecmascript.org/show_bug.cgi?id=3423 | 16 // + https://bugs.ecmascript.org/show_bug.cgi?id=3423 |
17 function RegExpGetFlags() { | 17 function RegExpGetFlags() { |
18 if (!IS_SPEC_OBJECT(this)) { | 18 if (!IS_SPEC_OBJECT(this)) { |
19 throw MakeTypeError(kFlagsGetterNonObject, $toString(this)); | 19 throw MakeTypeError(kFlagsGetterNonObject, $toString(this)); |
20 } | 20 } |
21 var result = ''; | 21 var result = ''; |
22 if (this.global) result += 'g'; | 22 if (this.global) result += 'g'; |
23 if (this.ignoreCase) result += 'i'; | 23 if (this.ignoreCase) result += 'i'; |
24 if (this.multiline) result += 'm'; | 24 if (this.multiline) result += 'm'; |
25 if (this.unicode) result += 'u'; | 25 if (this.unicode) result += 'u'; |
26 if (this.sticky) result += 'y'; | 26 if (this.sticky) result += 'y'; |
27 return result; | 27 return result; |
28 } | 28 } |
29 | 29 |
30 %DefineAccessorPropertyUnchecked(GlobalRegExp.prototype, 'flags', | 30 %DefineAccessorPropertyUnchecked(GlobalRegExp.prototype, 'flags', |
31 RegExpGetFlags, null, DONT_ENUM); | 31 RegExpGetFlags, null, DONT_ENUM); |
32 %SetNativeFlag(RegExpGetFlags); | 32 %SetNativeFlag(RegExpGetFlags); |
33 | 33 |
34 }) | 34 }) |
OLD | NEW |