Debian Codegraph @

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