| 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, utils) { | 5 (function(global, utils) { |
| 6 | 6 |
| 7 'use strict'; | 7 'use strict'; |
| 8 | 8 |
| 9 %CheckIsBootstrapping(); | 9 %CheckIsBootstrapping(); |
| 10 | 10 |
| 11 // ------------------------------------------------------------------- | 11 // ------------------------------------------------------------------- |
| 12 // Imports | 12 // Imports |
| 13 | 13 |
| 14 var GlobalRegExp = global.RegExp; | 14 var GlobalRegExp = global.RegExp; |
| 15 var ToString; | |
| 16 | |
| 17 utils.Import(function(from) { | |
| 18 ToString = from.ToString; | |
| 19 }); | |
| 20 | 15 |
| 21 // ------------------------------------------------------------------- | 16 // ------------------------------------------------------------------- |
| 22 | 17 |
| 23 // ES6 draft 12-06-13, section 21.2.5.3 | 18 // ES6 draft 12-06-13, section 21.2.5.3 |
| 24 // + https://bugs.ecmascript.org/show_bug.cgi?id=3423 | 19 // + https://bugs.ecmascript.org/show_bug.cgi?id=3423 |
| 25 function RegExpGetFlags() { | 20 function RegExpGetFlags() { |
| 26 if (!IS_SPEC_OBJECT(this)) { | 21 if (!IS_SPEC_OBJECT(this)) { |
| 27 throw MakeTypeError(kFlagsGetterNonObject, ToString(this)); | 22 throw MakeTypeError(kFlagsGetterNonObject, TO_STRING(this)); |
| 28 } | 23 } |
| 29 var result = ''; | 24 var result = ''; |
| 30 if (this.global) result += 'g'; | 25 if (this.global) result += 'g'; |
| 31 if (this.ignoreCase) result += 'i'; | 26 if (this.ignoreCase) result += 'i'; |
| 32 if (this.multiline) result += 'm'; | 27 if (this.multiline) result += 'm'; |
| 33 if (this.unicode) result += 'u'; | 28 if (this.unicode) result += 'u'; |
| 34 if (this.sticky) result += 'y'; | 29 if (this.sticky) result += 'y'; |
| 35 return result; | 30 return result; |
| 36 } | 31 } |
| 37 | 32 |
| 38 %DefineAccessorPropertyUnchecked(GlobalRegExp.prototype, 'flags', | 33 %DefineAccessorPropertyUnchecked(GlobalRegExp.prototype, 'flags', |
| 39 RegExpGetFlags, null, DONT_ENUM); | 34 RegExpGetFlags, null, DONT_ENUM); |
| 40 %SetNativeFlag(RegExpGetFlags); | 35 %SetNativeFlag(RegExpGetFlags); |
| 41 | 36 |
| 42 }) | 37 }) |
| OLD | NEW |