Closed Bug 1108467 Opened 9 years ago Closed 9 years ago

Implement RegExp.prototype.flags

Categories

(Core :: JavaScript: Standard Library, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla37

People

(Reporter: 446240525, Assigned: 446240525)

References

(Blocks 1 open bug)

Details

(Keywords: dev-doc-complete, Whiteboard: [DocArea=JS])

Attachments

(1 file, 2 obsolete files)

js> /foo/yg.flags
"gy"
js> Object.getOwnPropertyDescriptor(RegExp.prototype,"flags").get.call({sticky:1,unicode:1})
"yu"
Attached patch bug-1108467-v1.patch (obsolete) — Splinter Review
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+
Attached patch feedback addressed (obsolete) — Splinter Review
Attachment #8533163 - Attachment is obsolete: true
Attachment #8533470 - Flags: review?(till)
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)
Attached patch s/gimyu/gimuy/Splinter Review
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+
https://hg.mozilla.org/mozilla-central/rev/bc5ad20e8f27
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla37
See Also: → 1109577
Depends on: 1120151
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: