Debian Codegraph @

js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/contructor-calls-super-single-argument.js

raw
1 // Copyright (C) 2016 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 es6id: 22.1.1
5 description: >
6 Constructor calling super() with a single argument creates an Array object
7 info: |
8 22.1.1 The Array Constructor
9
10 The Array constructor is designed to be subclassable. It may be used as the
11 value of an extends clause of a class definition. Subclass constructors that
12 intend to inherit the exotic Array behaviour must include a super call to the
13 Array constructor to initialize subclass instances that are exotic Array
14 objects.
15 ---*/
16
17 class Sub extends Array {
18 constructor(a) {
19 super(a);
20 }
21 }
22
23 var sub = new Sub(42);
24
25 assert.sameValue(sub.length, 42);
26
27 reportCompare(0, 0);