Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: test/mjsunit/es6/legacy-subclassing.js

Issue 1574903004: TypedArray and ArrayBuffer support for @@species (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Preserve old behavior Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Before Symbol.species was added, ArrayBuffer subclasses constructed
adamk 2016/01/12 00:11:00 Might as well add: // Flags: --noharmony-species
6 // ArrayBuffers, but TypedArray and Promise subclasses constructed an instance
7 // of the subclass.
8
9 'use strict';
10
11 assertEquals(undefined, Symbol.species);
12
13 class MyUint8Array extends Uint8Array { }
14 Object.defineProperty(MyUint8Array.prototype, "BYTES_PER_ELEMENT", {value: 1});
15 let myArray = new MyUint8Array(3);
16 assertEquals(MyUint8Array, myArray.constructor);
17 assertEquals(MyUint8Array, myArray.map(x => x + 1).constructor);
18
19 class MyArrayBuffer extends ArrayBuffer { }
20 let myBuffer = new MyArrayBuffer(0);
21 assertEquals(MyArrayBuffer, myBuffer.constructor);
22 assertEquals(ArrayBuffer, myBuffer.slice().constructor);
23
24 class MyPromise extends Promise { }
25 let myPromise = new MyPromise(() => {});
26 assertEquals(MyPromise, myPromise.constructor);
27 assertEquals(MyPromise, myPromise.then().constructor);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698