Debian Codegraph @

js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/instance-name.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.2
5 description: Subclassed Function instances has length and name properties
6 info: |
7 19.2.4.2 name
8
9 The value of the name property is an String that is descriptive of the
10 function. The name has no semantic significance but is typically a variable or
11 property name that is used to refer to the function at its point of definition
12 in ECMAScript code. This property has the attributes { [[Writable]]: false,
13 [[Enumerable]]: false, [[Configurable]]: true }.
14
15 Anonymous functions objects that do not have a contextual name associated with
16 them by this specification do not have a name own property but inherit the
17 name property of %FunctionPrototype%.
18
19 19.2.1.1.1 RuntimeSemantics: CreateDynamicFunction(constructor, newTarget,
20 kind, args)
21
22 ...
23 29. Perform SetFunctionName(F, "anonymous").
24 ...
25 includes: [propertyHelper.js]
26 ---*/
27
28 class Fn extends Function {}
29
30 var fn = new Fn('a', 'b', 'return a + b');
31
32 verifyProperty(fn, 'name', {
33 value: 'anonymous',
34 writable: false,
35 enumerable: false,
36 configurable: true,
37 });
38
39 reportCompare(0, 0);