Debian Codegraph @

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