Implement RegExp.prototype.flags

RESOLVED FIXED in mozilla37

Status

()

Core
JavaScript: Standard Library
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: ziyunfei, Assigned: ziyunfei)

Tracking

(Blocks: 1 bug, {dev-doc-complete})

Trunk
mozilla37
dev-doc-complete
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [DocArea=JS])

Attachments

(1 attachment, 2 obsolete attachments)

(Assignee)

Description

3 years ago
js> /foo/yg.flags
"gy"
js> Object.getOwnPropertyDescriptor(RegExp.prototype,"flags").get.call({sticky:1,unicode:1})
"yu"
(Assignee)

Comment 1

3 years ago
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/flags
(Assignee)

Comment 2

3 years ago
Created attachment 8533163 [details] [diff] [review]
bug-1108467-v1.patch
Assignee: nobody → 446240525
Attachment #8533163 - Flags: review?(till)
Comment on attachment 8533163 [details] [diff] [review]
bug-1108467-v1.patch

Review of attachment 8533163 [details] [diff] [review]:
-----------------------------------------------------------------

This looks excellent, thanks!

r=me with feedback addressed.

::: js/src/tests/ecma_6/RegExp/flags.js
@@ +1,3 @@
> +/*
> + * Any copyright is dedicated to the Public Domain.
> + * http://creativecommons.org/licenses/publicdomain/

You can just leave out the license header: all test files default to CC0. If you keep it, please change the URL to https://creativecommons.org/publicdomain/zero/1.0/.

@@ +10,5 @@
> +
> +assertEq(RegExp.prototype.flags, "");
> +assertEq(/foo/iymg.flags, "gimy");
> +assertEq(RegExp("").flags, "");
> +assertEq(RegExp("", "mygi").flags, "gimy");

Please add a test that includes "u" when creating a regexp but doesn't reflect it in the `flags` getter. That way, we should get a heads-up once we add support for unicode regexps.
Attachment #8533163 - Flags: review?(till) → review+
(Assignee)

Comment 4

3 years ago
Created attachment 8533470 [details] [diff] [review]
feedback addressed
Attachment #8533163 - Attachment is obsolete: true
Attachment #8533470 - Flags: review?(till)
(Assignee)

Comment 5

3 years ago
Comment on attachment 8533470 [details] [diff] [review]
feedback addressed

Review of attachment 8533470 [details] [diff] [review]:
-----------------------------------------------------------------

https://bugs.ecmascript.org/show_bug.cgi?id=3423
Attachment #8533470 - Flags: review?(till)
(Assignee)

Comment 6

3 years ago
Created attachment 8533506 [details] [diff] [review]
s/gimyu/gimuy/
Attachment #8533470 - Attachment is obsolete: true
Attachment #8533506 - Flags: review?(till)
Comment on attachment 8533506 [details] [diff] [review]
s/gimyu/gimuy/

Review of attachment 8533506 [details] [diff] [review]:
-----------------------------------------------------------------

Wonderful.

It occurs to me just now that we might as well have self-hosted this. Too late now, though, so let's just land it.
Attachment #8533506 - Flags: review?(till) → review+
(Assignee)

Comment 8

3 years ago
https://treeherder.mozilla.org/ui/#/jobs?repo=try&revision=8673d6ad8ae8
Keywords: dev-doc-needed → checkin-needed, dev-doc-complete
https://hg.mozilla.org/integration/mozilla-inbound/rev/bc5ad20e8f27
Flags: in-testsuite+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/bc5ad20e8f27
Status: NEW → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla37

Updated

3 years ago
See Also: → bug 1109577

Updated

3 years ago
Depends on: 1120151
You need to log in before you can comment on or make changes to this bug.