f338188a8c
Bug: v8:7220 Change-Id: I9fef685f19cadbe87cd6451fe887f4c9c7d23b19 Reviewed-on: https://chromium-review.googlesource.com/1070337 Commit-Queue: Mathias Bynens <mathias@chromium.org> Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org> Cr-Commit-Position: refs/heads/master@{#53315}
32 lines
759 B
JavaScript
32 lines
759 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.
|
|
|
|
// Flags: --harmony-array-flat
|
|
|
|
{
|
|
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);
|
|
}
|