Debian Codegraph @

js/src/tests/test262/language/expressions/object/method-definition/fn-name-gen.js

raw
1 // Copyright (C) 2015 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 es6id: 14.4.13
6 description: >
7 Assignment of function `name` attribute (GeneratorMethod)
8 info: |
9 GeneratorMethod :
10 * PropertyName ( StrictFormalParameters ) { GeneratorBody }
11
12 [...]
13 9. Perform SetFunctionName(closure, propKey).
14 includes: [propertyHelper.js]
15 features: [generators, Symbol]
16 ---*/
17
18 var namedSym = Symbol('test262');
19 var anonSym = Symbol();
20 var o;
21
22 o = {
23 *id() {},
24 *[anonSym]() {},
25 *[namedSym]() {}
26 };
27
28 verifyProperty(o.id, 'name', {
29 value: 'id',
30 writable: false,
31 enumerable: false,
32 configurable: true,
33 });
34
35 verifyProperty(o[anonSym], 'name', {
36 value: '',
37 writable: false,
38 enumerable: false,
39 configurable: true,
40 });
41
42 verifyProperty(o[namedSym], 'name', {
43 value: '[test262]',
44 writable: false,
45 enumerable: false,
46 configurable: true,
47 });
48
49 reportCompare(0, 0);