Chromium Code Reviews

Unified Diff: src/js/macros.py

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.
Jump to:
View side-by-side diff with in-line comments
Index: src/js/macros.py
diff --git a/src/js/macros.py b/src/js/macros.py
index 856158aa898e6b509eb7fd7b0afc2036b497c149..6ea32f41d0235e9cc3d9067810967aca815af2b3 100644
--- a/src/js/macros.py
+++ b/src/js/macros.py
@@ -178,6 +178,13 @@ python macro CHAR_CODE(str) = ord(str[1]);
define REGEXP_NUMBER_OF_CAPTURES = 0;
define REGEXP_FIRST_CAPTURE = 3;
+macro REGEXP_GLOBAL(regexp) = (regexp[regExpFlagsSymbol] & 1);
Dan Ehrenberg 2015/11/02 19:21:06 Can you define constants for these numbers like 1,
Yang 2015/11/02 20:51:08 Isnt the point of macros.py to contain those const
+macro REGEXP_IGNORE_CASE(regexp) = (regexp[regExpFlagsSymbol] & 2);
+macro REGEXP_MULTILINE(regexp) = (regexp[regExpFlagsSymbol] & 4);
+macro REGEXP_STICKY(regexp) = (regexp[regExpFlagsSymbol] & 8);
+macro REGEXP_UNICODE(regexp) = (regexp[regExpFlagsSymbol] & 16);
+macro REGEXP_SOURCE(regexp) = (regexp[regExpSourceSymbol]);
+
# We can't put macros in macros so we use constants here.
# REGEXP_NUMBER_OF_CAPTURES
macro NUMBER_OF_CAPTURES(array) = ((array)[0]);
« no previous file with comments | « src/js/harmony-regexp.js ('k') | src/js/prologue.js » ('j') | test/mjsunit/regexp.js » ('J')

Powered by Google App Engine