Closed Bug 1113722 Opened 10 years ago Closed 10 years ago

Implement %TypedArray%.prototype.fill

Categories

(Core :: JavaScript: Standard Library, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla37

People

(Reporter: evilpie, Assigned: evilpie)

References

Details

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

Attachments

(1 file)

Attached patch typedarray-fillSplinter Review
      No description provided.
Attachment #8539357 - Flags: review?(till)
Comment on attachment 8539357 [details] [diff] [review]
typedarray-fill

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

::: js/src/builtin/TypedArray.js
@@ +1,5 @@
>  /* This Source Code Form is subject to the terms of the Mozilla Public
>   * License, v. 2.0. If a copy of the MPL was not distributed with this
>   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
>  
> +// ES6 draft rev28 (2014/10/14) 22.2.3.8 %TypedArray%.prototype.find(value [, start [, end ]])

s/find/fill/

::: js/src/tests/ecma_6/TypedArray/fill.js
@@ +58,5 @@
> +                         /* new Proxy(new constructor(), {}) // this probably should throw */
> +                         ];
> +    nonTypedArrays.forEach(nonTypedArray => {
> +        assertThrowsInstanceOf(function() {
> +            constructor.prototype.call.call(nonTypedArray, 1);

s/call/fill/1
Comment on attachment 8539357 [details] [diff] [review]
typedarray-fill

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

Very nice, thanks!

::: js/src/builtin/TypedArray.js
@@ +1,5 @@
>  /* This Source Code Form is subject to the terms of the Mozilla Public
>   * License, v. 2.0. If a copy of the MPL was not distributed with this
>   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
>  
> +// ES6 draft rev28 (2014/10/14) 22.2.3.8 %TypedArray%.prototype.find(value [, start [, end ]])

Draft 29 is out, please change the comment accordingly.

::: js/src/tests/ecma_6/TypedArray/fill.js
@@ +10,5 @@
> +    Float64Array
> +];
> +
> +for (var constructor of constructors) {
> +

nit: remove blank line

@@ +46,5 @@
> +    assertDeepEq(new constructor([1,1,1]).fill(2, "-2", "-1"), new constructor([1,2,1]));
> +    assertDeepEq(new constructor([1,1,1]).fill(2, {valueOf: ()=>1}), new constructor([1,2,2]));
> +    assertDeepEq(new constructor([1,1,1]).fill(2, 0, {valueOf: ()=>1}), new constructor([2,1,1]));
> +
> +    // called from other globals

nit: start full-sentence comments with upper-case letter and end with ".". Here and below
Attachment #8539357 - Flags: review?(till) → review+
https://hg.mozilla.org/mozilla-central/rev/3b7cd31a7b22
Status: NEW → RESOLVED
Closed: 10 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla37
Whiteboard: [DocArea=JS]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: