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

Unified Diff: src/js/harmony-regexp.js

Issue 1419823010: Implement flag and source getters on RegExp.prototype. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@rproto
Patch Set: fix windows build Created 5 years, 2 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/heap/heap.h ('k') | src/js/macros.py » ('j') | src/js/macros.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/js/harmony-regexp.js
diff --git a/src/js/harmony-regexp.js b/src/js/harmony-regexp.js
index 033ee2c9a513abecf05a9dbc4b67571fb3a3d516..0aed90c9f4e9a630199ae0b39443e8d943dc9642 100644
--- a/src/js/harmony-regexp.js
+++ b/src/js/harmony-regexp.js
@@ -11,6 +11,7 @@
// -------------------------------------------------------------------
// Imports
+var GetRegExpFlagGetter = utils.ImportNow("GetRegExpFlagGetter");
var GlobalRegExp = global.RegExp;
var MakeTypeError;
@@ -24,7 +25,8 @@ utils.Import(function(from) {
// + https://bugs.ecmascript.org/show_bug.cgi?id=3423
function RegExpGetFlags() {
if (!IS_SPEC_OBJECT(this)) {
- throw MakeTypeError(kFlagsGetterNonObject, TO_STRING(this));
+ throw MakeTypeError(
+ kRegExpNonObject, "RegExp.prototype.flags", TO_STRING(this));
}
var result = '';
if (this.global) result += 'g';
@@ -39,4 +41,9 @@ function RegExpGetFlags() {
RegExpGetFlags, null, DONT_ENUM);
%SetNativeFlag(RegExpGetFlags);
+%DefineGetterPropertyUnchecked(GlobalRegExp.prototype, "sticky",
+ GetRegExpFlagGetter("RegExp.prototype.sticky", 8), DONT_ENUM);
+
+%DefineGetterPropertyUnchecked(GlobalRegExp.prototype, "unicode",
+ GetRegExpFlagGetter("RegExp.prototype.unicode", 16), DONT_ENUM);
})
« no previous file with comments | « src/heap/heap.h ('k') | src/js/macros.py » ('j') | src/js/macros.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698