b62a7f18cb
It shipped in Chrome 69. Bug: v8:7220, v8:8562 Change-Id: I09d5ee9e98fc32ae3163c8983d552b99ac4f08e6 Reviewed-on: https://chromium-review.googlesource.com/c/1450781 Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Commit-Queue: Mathias Bynens <mathias@chromium.org> Cr-Commit-Position: refs/heads/master@{#59309}
30 lines
727 B
JavaScript
30 lines
727 B
JavaScript
// Copyright 2018 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
{
|
|
class MyArray extends Array {
|
|
static get [Symbol.species]() {
|
|
return Array;
|
|
}
|
|
}
|
|
|
|
const wannabe = new MyArray();
|
|
const result = wannabe.flatMap(x => [x, x]);
|
|
assertEquals(false, result instanceof MyArray);
|
|
assertEquals(true, result instanceof Array);
|
|
}
|
|
|
|
{
|
|
class MyArray extends Array {
|
|
static get [Symbol.species]() {
|
|
return this;
|
|
}
|
|
}
|
|
|
|
const wannabe = new MyArray();
|
|
const result = wannabe.flatMap(x => [x, x]);
|
|
assertEquals(true, result instanceof MyArray);
|
|
assertEquals(true, result instanceof Array);
|
|
}
|