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

Unified Diff: src/js/regexp.js

Issue 1431433004: Revert of Remove RegExp.multiline accessors. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | « no previous file | test/mjsunit/regexp-static.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 09c59227b3d76faf864f3816032433a67d33d59e..495ba37fe9a5fdb662b132283cac6d1b1be93960 100644
--- a/src/js/regexp.js
+++ b/src/js/regexp.js
@@ -367,6 +367,25 @@
%DefineAccessorPropertyUnchecked(GlobalRegExp, '$_', RegExpGetInput,
RegExpSetInput, DONT_ENUM | DONT_DELETE);
+// The properties multiline and $* are aliases for each other. When this
+// value is set in SpiderMonkey, the value it is set to is coerced to a
+// boolean. We mimic that behavior with a slight difference: in SpiderMonkey
+// the value of the expression 'RegExp.multiline = null' (for instance) is the
+// boolean false (i.e., the value after coercion), while in V8 it is the value
+// null (i.e., the value before coercion).
+
+// Getter and setter for multiline.
+var multiline = false;
+var RegExpGetMultiline = function() { return multiline; };
+var RegExpSetMultiline = function(flag) { multiline = flag ? true : false; };
+
+%DefineAccessorPropertyUnchecked(GlobalRegExp, 'multiline', RegExpGetMultiline,
+ RegExpSetMultiline, DONT_DELETE);
+%DefineAccessorPropertyUnchecked(GlobalRegExp, '$*', RegExpGetMultiline,
+ RegExpSetMultiline,
+ DONT_ENUM | DONT_DELETE);
+
+
var NoOpSetter = function(ignored) {};
« no previous file with comments | « no previous file | test/mjsunit/regexp-static.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698