Debian Codegraph @

js/src/tests/test262/language/expressions/object/method-definition/fn-name-fn.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: 12.2.6.9
6 description: Assignment of function `name` attribute (MethodDefinition)
7 info: |
8 6. If IsAnonymousFunctionDefinition(AssignmentExpression) is true, then
9 a. Let hasNameProperty be HasOwnProperty(propValue, "name").
10 b. ReturnIfAbrupt(hasNameProperty).
11 c. If hasNameProperty is false, perform SetFunctionName(propValue,
12 propKey).
13 includes: [propertyHelper.js]
14 features: [Symbol]
15 ---*/
16
17 var namedSym = Symbol('test262');
18 var anonSym = Symbol();
19 var o;
20
21 o = {
22 id() {},
23 [anonSym]() {},
24 [namedSym]() {}
25 };
26
27 verifyProperty(o.id, 'name', {
28 value: 'id',
29 writable: false,
30 enumerable: false,
31 configurable: true,
32 });
33
34 verifyProperty(o[anonSym], 'name', {
35 value: '',
36 writable: false,
37 enumerable: false,
38 configurable: true,
39 });
40
41 verifyProperty(o[namedSym], 'name', {
42 value: '[test262]',
43 writable: false,
44 enumerable: false,
45 configurable: true,
46 });
47
48 reportCompare(0, 0);