Index: src/regexp.js |
diff --git a/src/regexp.js b/src/regexp.js |
index 4f2eb62c7279523793a9eecea54d739f8e454b25..b724f68183511701da41555a346c436179cf6c01 100644 |
--- a/src/regexp.js |
+++ b/src/regexp.js |
@@ -421,16 +421,18 @@ function SetUpRegExp() { |
LAST_INPUT(lastMatchInfo) = ToString(string); |
}; |
- %DefineAccessor($RegExp, 'input', GETTER, RegExpGetInput, DONT_DELETE); |
- %DefineAccessor($RegExp, 'input', SETTER, RegExpSetInput, DONT_DELETE); |
- %DefineAccessor($RegExp, '$_', GETTER, RegExpGetInput, |
- DONT_ENUM | DONT_DELETE); |
- %DefineAccessor($RegExp, '$_', SETTER, RegExpSetInput, |
- DONT_ENUM | DONT_DELETE); |
- %DefineAccessor($RegExp, '$input', GETTER, RegExpGetInput, |
- DONT_ENUM | DONT_DELETE); |
- %DefineAccessor($RegExp, '$input', SETTER, RegExpSetInput, |
- DONT_ENUM | DONT_DELETE); |
+ %DefineOrRedefineAccessorProperty($RegExp, 'input', GETTER, RegExpGetInput, |
+ DONT_DELETE); |
+ %DefineOrRedefineAccessorProperty($RegExp, 'input', SETTER, RegExpSetInput, |
+ DONT_DELETE); |
+ %DefineOrRedefineAccessorProperty($RegExp, '$_', GETTER, RegExpGetInput, |
+ DONT_ENUM | DONT_DELETE); |
+ %DefineOrRedefineAccessorProperty($RegExp, '$_', SETTER, RegExpSetInput, |
+ DONT_ENUM | DONT_DELETE); |
+ %DefineOrRedefineAccessorProperty($RegExp, '$input', GETTER, RegExpGetInput, |
+ DONT_ENUM | DONT_DELETE); |
+ %DefineOrRedefineAccessorProperty($RegExp, '$input', SETTER, 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 |
@@ -444,49 +446,59 @@ function SetUpRegExp() { |
var RegExpGetMultiline = function() { return multiline; }; |
var RegExpSetMultiline = function(flag) { multiline = flag ? true : false; }; |
- %DefineAccessor($RegExp, 'multiline', GETTER, RegExpGetMultiline, |
- DONT_DELETE); |
- %DefineAccessor($RegExp, 'multiline', SETTER, RegExpSetMultiline, |
- DONT_DELETE); |
- %DefineAccessor($RegExp, '$*', GETTER, RegExpGetMultiline, |
- DONT_ENUM | DONT_DELETE); |
- %DefineAccessor($RegExp, '$*', SETTER, RegExpSetMultiline, |
- DONT_ENUM | DONT_DELETE); |
+ %DefineOrRedefineAccessorProperty($RegExp, 'multiline', GETTER, |
+ RegExpGetMultiline, DONT_DELETE); |
+ %DefineOrRedefineAccessorProperty($RegExp, 'multiline', SETTER, |
+ RegExpSetMultiline, DONT_DELETE); |
+ %DefineOrRedefineAccessorProperty($RegExp, '$*', GETTER, RegExpGetMultiline, |
+ DONT_ENUM | DONT_DELETE); |
+ %DefineOrRedefineAccessorProperty($RegExp, '$*', SETTER, RegExpSetMultiline, |
+ DONT_ENUM | DONT_DELETE); |
var NoOpSetter = function(ignored) {}; |
// Static properties set by a successful match. |
- %DefineAccessor($RegExp, 'lastMatch', GETTER, RegExpGetLastMatch, |
- DONT_DELETE); |
- %DefineAccessor($RegExp, 'lastMatch', SETTER, NoOpSetter, DONT_DELETE); |
- %DefineAccessor($RegExp, '$&', GETTER, RegExpGetLastMatch, |
- DONT_ENUM | DONT_DELETE); |
- %DefineAccessor($RegExp, '$&', SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE); |
- %DefineAccessor($RegExp, 'lastParen', GETTER, RegExpGetLastParen, |
- DONT_DELETE); |
- %DefineAccessor($RegExp, 'lastParen', SETTER, NoOpSetter, DONT_DELETE); |
- %DefineAccessor($RegExp, '$+', GETTER, RegExpGetLastParen, |
- DONT_ENUM | DONT_DELETE); |
- %DefineAccessor($RegExp, '$+', SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE); |
- %DefineAccessor($RegExp, 'leftContext', GETTER, RegExpGetLeftContext, |
- DONT_DELETE); |
- %DefineAccessor($RegExp, 'leftContext', SETTER, NoOpSetter, DONT_DELETE); |
- %DefineAccessor($RegExp, '$`', GETTER, RegExpGetLeftContext, |
- DONT_ENUM | DONT_DELETE); |
- %DefineAccessor($RegExp, '$`', SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE); |
- %DefineAccessor($RegExp, 'rightContext', GETTER, RegExpGetRightContext, |
- DONT_DELETE); |
- %DefineAccessor($RegExp, 'rightContext', SETTER, NoOpSetter, DONT_DELETE); |
- %DefineAccessor($RegExp, "$'", GETTER, RegExpGetRightContext, |
- DONT_ENUM | DONT_DELETE); |
- %DefineAccessor($RegExp, "$'", SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE); |
+ %DefineOrRedefineAccessorProperty($RegExp, 'lastMatch', GETTER, |
+ RegExpGetLastMatch, DONT_DELETE); |
+ %DefineOrRedefineAccessorProperty($RegExp, 'lastMatch', SETTER, NoOpSetter, |
+ DONT_DELETE); |
+ %DefineOrRedefineAccessorProperty($RegExp, '$&', GETTER, RegExpGetLastMatch, |
+ DONT_ENUM | DONT_DELETE); |
+ %DefineOrRedefineAccessorProperty($RegExp, '$&', SETTER, NoOpSetter, |
+ DONT_ENUM | DONT_DELETE); |
+ %DefineOrRedefineAccessorProperty($RegExp, 'lastParen', GETTER, |
+ RegExpGetLastParen, DONT_DELETE); |
+ %DefineOrRedefineAccessorProperty($RegExp, 'lastParen', SETTER, NoOpSetter, |
+ DONT_DELETE); |
+ %DefineOrRedefineAccessorProperty($RegExp, '$+', GETTER, RegExpGetLastParen, |
+ DONT_ENUM | DONT_DELETE); |
+ %DefineOrRedefineAccessorProperty($RegExp, '$+', SETTER, NoOpSetter, |
+ DONT_ENUM | DONT_DELETE); |
+ %DefineOrRedefineAccessorProperty($RegExp, 'leftContext', GETTER, |
+ RegExpGetLeftContext, DONT_DELETE); |
+ %DefineOrRedefineAccessorProperty($RegExp, 'leftContext', SETTER, NoOpSetter, |
+ DONT_DELETE); |
+ %DefineOrRedefineAccessorProperty($RegExp, '$`', GETTER, RegExpGetLeftContext, |
+ DONT_ENUM | DONT_DELETE); |
+ %DefineOrRedefineAccessorProperty($RegExp, '$`', SETTER, NoOpSetter, |
+ DONT_ENUM | DONT_DELETE); |
+ %DefineOrRedefineAccessorProperty($RegExp, 'rightContext', GETTER, |
+ RegExpGetRightContext, DONT_DELETE); |
+ %DefineOrRedefineAccessorProperty($RegExp, 'rightContext', SETTER, NoOpSetter, |
+ DONT_DELETE); |
+ %DefineOrRedefineAccessorProperty($RegExp, "$'", GETTER, |
+ RegExpGetRightContext, |
+ DONT_ENUM | DONT_DELETE); |
+ %DefineOrRedefineAccessorProperty($RegExp, "$'", SETTER, NoOpSetter, |
+ DONT_ENUM | DONT_DELETE); |
for (var i = 1; i < 10; ++i) { |
- %DefineAccessor($RegExp, '$' + i, GETTER, RegExpMakeCaptureGetter(i), |
- DONT_DELETE); |
- %DefineAccessor($RegExp, '$' + i, SETTER, NoOpSetter, DONT_DELETE); |
+ %DefineOrRedefineAccessorProperty($RegExp, '$' + i, GETTER, |
+ RegExpMakeCaptureGetter(i), DONT_DELETE); |
+ %DefineOrRedefineAccessorProperty($RegExp, '$' + i, SETTER, NoOpSetter, |
+ DONT_DELETE); |
} |
} |