Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: src/harmony-regexp.js

Issue 1100673002: Wrap harmony implementations in functions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/harmony-reflect.js ('k') | src/harmony-spread.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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() {
6
5 'use strict'; 7 'use strict';
6 8
7 var $RegExp = global.RegExp; 9 %CheckIsBootstrapping();
10
11 var GlobalRegExp = global.RegExp;
8 12
9 // ------------------------------------------------------------------- 13 // -------------------------------------------------------------------
10 14
11 // ES6 draft 12-06-13, section 21.2.5.3 15 // ES6 draft 12-06-13, section 21.2.5.3
12 // + https://bugs.ecmascript.org/show_bug.cgi?id=3423 16 // + https://bugs.ecmascript.org/show_bug.cgi?id=3423
13 function RegExpGetFlags() { 17 function RegExpGetFlags() {
14 if (!IS_SPEC_OBJECT(this)) { 18 if (!IS_SPEC_OBJECT(this)) {
15 throw MakeTypeError('flags_getter_non_object', 19 throw MakeTypeError('flags_getter_non_object',
16 [%ToString(this)]); 20 [%ToString(this)]);
17 } 21 }
18 var result = ''; 22 var result = '';
19 if (this.global) result += 'g'; 23 if (this.global) result += 'g';
20 if (this.ignoreCase) result += 'i'; 24 if (this.ignoreCase) result += 'i';
21 if (this.multiline) result += 'm'; 25 if (this.multiline) result += 'm';
22 if (this.unicode) result += 'u'; 26 if (this.unicode) result += 'u';
23 if (this.sticky) result += 'y'; 27 if (this.sticky) result += 'y';
24 return result; 28 return result;
25 } 29 }
26 30
27 function ExtendRegExpPrototype() { 31 %DefineAccessorPropertyUnchecked(GlobalRegExp.prototype, 'flags',
28 %CheckIsBootstrapping(); 32 RegExpGetFlags, null, DONT_ENUM);
33 %SetNativeFlag(RegExpGetFlags);
29 34
30 %DefineAccessorPropertyUnchecked($RegExp.prototype, 'flags', RegExpGetFlags, 35 })();
31 null, DONT_ENUM);
32 %SetNativeFlag(RegExpGetFlags);
33 }
34
35 ExtendRegExpPrototype();
OLDNEW
« no previous file with comments | « src/harmony-reflect.js ('k') | src/harmony-spread.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698