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

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

Issue 1838563003: Remove --harmony-regexps flag (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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/flag-definitions.h ('k') | src/js/regexp.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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
5 (function(global, utils) {
6
7 'use strict';
8
9 %CheckIsBootstrapping();
10
11 // -------------------------------------------------------------------
12 // Imports
13
14 var GlobalRegExp = global.RegExp;
15 var GlobalRegExpPrototype = GlobalRegExp.prototype;
16 var MakeTypeError;
17 var regExpFlagsSymbol = utils.ImportNow("regexp_flags_symbol");
18
19 utils.Import(function(from) {
20 MakeTypeError = from.MakeTypeError;
21 });
22
23 // -------------------------------------------------------------------
24
25 // ES6 draft 12-06-13, section 21.2.5.3
26 // + https://bugs.ecmascript.org/show_bug.cgi?id=3423
27 function RegExpGetFlags() {
28 if (!IS_RECEIVER(this)) {
29 throw MakeTypeError(
30 kRegExpNonObject, "RegExp.prototype.flags", TO_STRING(this));
31 }
32 var result = '';
33 if (this.global) result += 'g';
34 if (this.ignoreCase) result += 'i';
35 if (this.multiline) result += 'm';
36 if (this.unicode) result += 'u';
37 if (this.sticky) result += 'y';
38 return result;
39 }
40
41 // ES6 21.2.5.12.
42 function RegExpGetSticky() {
43 if (!IS_REGEXP(this)) {
44 // Compat fix: RegExp.prototype.sticky == undefined; UseCounter tracks it
45 // TODO(littledan): Remove this workaround or standardize it
46 if (this === GlobalRegExpPrototype) {
47 %IncrementUseCounter(kRegExpPrototypeStickyGetter);
48 return UNDEFINED;
49 }
50 throw MakeTypeError(kRegExpNonRegExp, "RegExp.prototype.sticky");
51 }
52 return !!REGEXP_STICKY(this);
53 }
54 %FunctionSetName(RegExpGetSticky, "RegExp.prototype.sticky");
55 %SetNativeFlag(RegExpGetSticky);
56
57 utils.InstallGetter(GlobalRegExp.prototype, 'flags', RegExpGetFlags);
58 utils.InstallGetter(GlobalRegExp.prototype, 'sticky', RegExpGetSticky);
59
60 })
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | src/js/regexp.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698