| Index: src/js/regexp.js
|
| diff --git a/src/js/regexp.js b/src/js/regexp.js
|
| index ef6a4aed053b3d15f23056a64c4540112be08337..a881c490006b8e961c8c8a1125952231f986e409 100644
|
| --- a/src/js/regexp.js
|
| +++ b/src/js/regexp.js
|
| @@ -141,7 +141,7 @@ function DoRegExpExec(regexp, string, index) {
|
| // This is kind of performance sensitive, so we want to avoid unnecessary
|
| // type checks on inputs. But we also don't want to inline it several times
|
| // manually, so we use a macro :-)
|
| -macro RETURN_NEW_RESULT_FROM_MATCH_INFO(MATCHINFO, STRING)
|
| +macro RETURN_NEW_RESULT_FROM_MATCH_INFO(MATCHINFO, STRING, JSREGEXP)
|
| var numResults = NUMBER_OF_CAPTURES(MATCHINFO) >> 1;
|
| var start = MATCHINFO[CAPTURE0];
|
| var end = MATCHINFO[CAPTURE1];
|
| @@ -160,6 +160,9 @@ macro RETURN_NEW_RESULT_FROM_MATCH_INFO(MATCHINFO, STRING)
|
| }
|
| j++;
|
| }
|
| + // For each named capture 'a', create a property result.a containing the
|
| + // corresponding captured string.
|
| + %RegExpResultAttachNamedCaptures(result, JSREGEXP);
|
| return result;
|
| endmacro
|
|
|
| @@ -170,7 +173,7 @@ function RegExpExecNoTests(regexp, string, start) {
|
| if (matchInfo !== null) {
|
| // ES6 21.2.5.2.2 step 18.
|
| if (REGEXP_STICKY(regexp)) regexp.lastIndex = matchInfo[CAPTURE1];
|
| - RETURN_NEW_RESULT_FROM_MATCH_INFO(matchInfo, string);
|
| + RETURN_NEW_RESULT_FROM_MATCH_INFO(matchInfo, string, regexp);
|
| }
|
| regexp.lastIndex = 0;
|
| return null;
|
| @@ -219,7 +222,7 @@ function RegExpSubclassExecJS(string) {
|
| if (updateLastIndex) {
|
| this.lastIndex = RegExpLastMatchInfo[CAPTURE1];
|
| }
|
| - RETURN_NEW_RESULT_FROM_MATCH_INFO(matchIndices, string);
|
| + RETURN_NEW_RESULT_FROM_MATCH_INFO(matchIndices, string, this);
|
| }
|
| %FunctionRemovePrototype(RegExpSubclassExecJS);
|
|
|
| @@ -260,7 +263,7 @@ function RegExpExecJS(string) {
|
| if (updateLastIndex) {
|
| this.lastIndex = RegExpLastMatchInfo[CAPTURE1];
|
| }
|
| - RETURN_NEW_RESULT_FROM_MATCH_INFO(matchIndices, string);
|
| + RETURN_NEW_RESULT_FROM_MATCH_INFO(matchIndices, string, this);
|
| }
|
|
|
|
|
| @@ -1214,7 +1217,7 @@ var InternalRegExpMatchInfo = new InternalPackedArray(2, "", UNDEFINED, 0, 0);
|
| function InternalRegExpMatch(regexp, subject) {
|
| var matchInfo = %_RegExpExec(regexp, subject, 0, InternalRegExpMatchInfo);
|
| if (!IS_NULL(matchInfo)) {
|
| - RETURN_NEW_RESULT_FROM_MATCH_INFO(matchInfo, subject);
|
| + RETURN_NEW_RESULT_FROM_MATCH_INFO(matchInfo, subject, regexp);
|
| }
|
| return null;
|
| }
|
|
|