Commit 8c0f2315 authored by jgruber's avatar jgruber Committed by Commit bot

[regexp] Rename result.group to result.groups

This is just an update to reflect the current spec proposal.
https://tc39.github.io/proposal-regexp-named-groups/

BUG=v8:5437

Review-Url: https://codereview.chromium.org/2769143002
Cr-Commit-Position: refs/heads/master@{#44067}
parent 3cbb2a50
......@@ -165,7 +165,7 @@ Node* RegExpBuiltinsAssembler::ConstructNewResultFromMatchInfo(
// Store it on the result as a 'group' property.
{
Node* const name = HeapConstant(isolate()->factory()->group_string());
Node* const name = HeapConstant(isolate()->factory()->groups_string());
CallRuntime(Runtime::kCreateDataProperty, context, result, name,
group_object);
}
......
......@@ -80,7 +80,7 @@
V(get_string, "get") \
V(get_space_string, "get ") \
V(global_string, "global") \
V(group_string, "group") \
V(groups_string, "groups") \
V(has_string, "has") \
V(hour_string, "hour") \
V(ignoreCase_string, "ignoreCase") \
......
......@@ -76,23 +76,23 @@ assertEquals(["bab", "b"], "bab".match(/\k<a>(?<a>b)\w\k<a>/u));
assertEquals(["bab", "b", "a"], "bab".match(/(?<b>b)\k<a>(?<a>a)\k<b>/u));
// Reference properties.
assertEquals("a", /(?<a>a)(?<b>b)\k<a>/u.exec("aba").group.a);
assertEquals("b", /(?<a>a)(?<b>b)\k<a>/u.exec("aba").group.b);
assertEquals(undefined, /(?<a>a)(?<b>b)\k<a>/u.exec("aba").group.c);
assertEquals(undefined, /(?<a>a)(?<b>b)\k<a>|(?<c>c)/u.exec("aba").group.c);
assertEquals("a", /(?<a>a)(?<b>b)\k<a>/u.exec("aba").groups.a);
assertEquals("b", /(?<a>a)(?<b>b)\k<a>/u.exec("aba").groups.b);
assertEquals(undefined, /(?<a>a)(?<b>b)\k<a>/u.exec("aba").groups.c);
assertEquals(undefined, /(?<a>a)(?<b>b)\k<a>|(?<c>c)/u.exec("aba").groups.c);
// Unicode names.
assertEquals("a", /(?<π>a)/u.exec("bab").group.π);
assertEquals("a", /(?<\u{03C0}>a)/u.exec("bab").group.\u03C0);
assertEquals("a", /(?<$>a)/u.exec("bab").group.$);
assertEquals("a", /(?<_>a)/u.exec("bab").group._);
assertEquals("a", /(?<$𐒤>a)/u.exec("bab").group.$𐒤);
assertEquals("a", /(?<_\u200C>a)/u.exec("bab").group._\u200C);
assertEquals("a", /(?<_\u200D>a)/u.exec("bab").group._\u200D);
assertEquals("a", /(?<ಠ_ಠ>a)/u.exec("bab").group._);
assertEquals("a", /(?<π>a)/u.exec("bab").groups.π);
assertEquals("a", /(?<\u{03C0}>a)/u.exec("bab").groups.\u03C0);
assertEquals("a", /(?<$>a)/u.exec("bab").groups.$);
assertEquals("a", /(?<_>a)/u.exec("bab").groups._);
assertEquals("a", /(?<$𐒤>a)/u.exec("bab").groups.$𐒤);
assertEquals("a", /(?<_\u200C>a)/u.exec("bab").groups._\u200C);
assertEquals("a", /(?<_\u200D>a)/u.exec("bab").groups._\u200D);
assertEquals("a", /(?<ಠ_ಠ>a)/u.exec("bab").groups._);
assertThrows('/(?<❤>a)/u', SyntaxError);
assertThrows('/(?<𐒤>a)/u', SyntaxError); // ID_Continue but not ID_Start.
// The '__proto__' property on the groups object.
assertEquals(undefined, /(?<a>.)/u.exec("a").group.__proto__);
assertEquals("a", /(?<__proto__>a)/u.exec("a").group.__proto__);
assertEquals(undefined, /(?<a>.)/u.exec("a").groups.__proto__);
assertEquals("a", /(?<__proto__>a)/u.exec("a").groups.__proto__);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment