Chromium Code Reviews| Index: src/harmony-regexp.js |
| diff --git a/src/harmony-regexp.js b/src/harmony-regexp.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2090aab4ec1cd43a84a2c4ba41384379cc56984b |
| --- /dev/null |
| +++ b/src/harmony-regexp.js |
| @@ -0,0 +1,33 @@ |
| +// Copyright 2014 the V8 project authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
|
Dmitry Lomov (no reviews)
2014/12/10 16:06:29
style nit: 'use strict'
|
| +var $RegExp = global.RegExp; |
| + |
| +// ------------------------------------------------------------------- |
| + |
| +// ES6 draft 12-06-13, section 21.2.5.3 |
| +// + https://bugs.ecmascript.org/show_bug.cgi?id=3423 |
| +var RegExpGetFlags = function() { |
|
Dmitry Lomov (no reviews)
2014/12/10 16:06:29
style nit: just use function RegExpGetFlags here.
|
| + if (!IS_SPEC_OBJECT(this)) { |
| + throw MakeTypeError('flags_getter_non_object', |
| + [%ToString(this)]); |
| + } |
| + var result = ''; |
| + if (this.global) result += 'g'; |
| + if (this.ignoreCase) result += 'i'; |
| + if (this.multiline) result += 'm'; |
| + if (this.unicode) result += 'u'; |
| + if (this.sticky) result += 'y'; |
| + return result; |
| +}; |
| + |
| +function ExtendRegExpPrototype() { |
| + %CheckIsBootstrapping(); |
| + |
| + %DefineAccessorPropertyUnchecked($RegExp.prototype, 'flags', RegExpGetFlags, |
| + null, DONT_ENUM | DONT_DELETE); |
| + %SetNativeFlag(RegExpGetFlags); |
| +} |
| + |
| +ExtendRegExpPrototype(); |