Closed Bug 1935427 Opened 2 months ago Closed 2 months ago

Implement Iterator.range method

Categories

(Core :: JavaScript: Standard Library, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
135 Branch
Tracking Status
firefox135 --- fixed

People

(Reporter: dminor, Assigned: sarahngima77)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

The Iterator.range method itself is quite simple, it just delegates to another function, called CreateNumericRangeIterator. As a starting point, let's add a CreateNumericRangeIterator method that returns false, and call it from Iterator.range. For the last parameter type, let's make it a boolean called isNumberRange, and use true for NUMBER-RANGE and false for BIGINT-RANGE.

You can use typeof to figure out the types of the arguments, and ThrowTypeError to throw if start is not a number, but you'll first need to add a new error message to the bottom of ErrorNumbers.msg.

Please include the specification steps in the function implementation, there's already examples of how to format this in Iterator.js

Instead of having it in it's own #ifdef NIGHTLY_BUILD block at the top of the file, please move everything down into the larger #ifdef NIGHTLY_BUILD block at the bottom of the file, right underneath IteratorZipKeyed.

There's also a mistake in Iteratation.cpp, the number of arguments for Iterator.range should be 3 instead of 1. This needs to be fixed first, or you'll see assertions in debug builds when you attempt to use Iterator.range.

Finally, let's add a new file for Iterator.range tests under js/src/tests/non262/Iterator/range.js. Eventually we're planning to upstream our tests to Test262, but for now, let's use something local. You can write some tests to make sure Iterator.range throws when given something other than a number or bigint.

Summary: Implement Iterator.range → Implement Iterator.range method
Blocks: 1935506
Assignee: nobody → sarahngima77
Status: NEW → ASSIGNED
Severity: -- → N/A
Priority: -- → P3
Pushed by dminor@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/1ebe5a5ace33 Implement Iterator.range method; r=dminor
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 135 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: