Debian Codegraph @

js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/instance-length.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: 19.2.4.1
5 description: Subclassed Function instances has length and name properties
6 info: |
7 19.2.4.1 length
8
9 The value of the length property is an integer that indicates the typical
10 number of arguments expected by the function. However, the language permits
11 the function to be invoked with some other number of arguments. The behaviour
12 of a function when invoked on a number of arguments other than the number
13 specified by its length property depends on the function. This property has
14 the attributes { [[Writable]]: false, [[Enumerable]]: false,
15 [[Configurable]]: true }.
16 includes: [propertyHelper.js]
17 ---*/
18
19 class Fn extends Function {}
20
21 var fn = new Fn('a', 'b', 'return a + b');
22
23 verifyProperty(fn, 'length', {
24 value: 2,
25 writable: false,
26 enumerable: false,
27 configurable: true,
28 });
29
30 reportCompare(0, 0);