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

Unified Diff: src/js/regexp.js

Issue 1640803003: ES2015 web compat workaround: RegExp.prototype.flags => "" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix webkit test Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/js/harmony-unicode-regexps.js ('k') | test/mjsunit/es6/regexp-flags.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/js/regexp.js
diff --git a/src/js/regexp.js b/src/js/regexp.js
index 2ad7e336ea8c30a7cc3c22dd35fad345f0864d09..b3305e1159de2dabb072784e26c0f5f77ad04697 100644
--- a/src/js/regexp.js
+++ b/src/js/regexp.js
@@ -628,6 +628,10 @@ function RegExpMakeCaptureGetter(n) {
// ES6 21.2.5.4.
function RegExpGetGlobal() {
if (!IS_REGEXP(this)) {
+ // TODO(littledan): Remove this RegExp compat workaround
+ if (this === GlobalRegExpPrototype) {
+ return UNDEFINED;
+ }
throw MakeTypeError(kRegExpNonRegExp, "RegExp.prototype.global");
}
return !!REGEXP_GLOBAL(this);
@@ -639,6 +643,10 @@ function RegExpGetGlobal() {
// ES6 21.2.5.5.
function RegExpGetIgnoreCase() {
if (!IS_REGEXP(this)) {
+ // TODO(littledan): Remove this RegExp compat workaround
+ if (this === GlobalRegExpPrototype) {
+ return UNDEFINED;
+ }
throw MakeTypeError(kRegExpNonRegExp, "RegExp.prototype.ignoreCase");
}
return !!REGEXP_IGNORE_CASE(this);
@@ -650,6 +658,10 @@ function RegExpGetIgnoreCase() {
// ES6 21.2.5.7.
function RegExpGetMultiline() {
if (!IS_REGEXP(this)) {
+ // TODO(littledan): Remove this RegExp compat workaround
+ if (this === GlobalRegExpPrototype) {
+ return UNDEFINED;
+ }
throw MakeTypeError(kRegExpNonRegExp, "RegExp.prototype.multiline");
}
return !!REGEXP_MULTILINE(this);
@@ -661,6 +673,10 @@ function RegExpGetMultiline() {
// ES6 21.2.5.10.
function RegExpGetSource() {
if (!IS_REGEXP(this)) {
+ // TODO(littledan): Remove this RegExp compat workaround
+ if (this === GlobalRegExpPrototype) {
+ return UNDEFINED;
+ }
throw MakeTypeError(kRegExpNonRegExp, "RegExp.prototype.source");
}
return REGEXP_SOURCE(this);
« no previous file with comments | « src/js/harmony-unicode-regexps.js ('k') | test/mjsunit/es6/regexp-flags.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698