Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/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 assert.sameValue(o.id.name, 'id', 'via IdentifierName');
32 verifyNotEnumerable(o.id, 'name');
33 verifyNotWritable(o.id, 'name');
34 verifyConfigurable(o.id, 'name');
35
36 assert.sameValue(o[anonSym].name, '', 'via anonymous Symbol');
37 verifyNotEnumerable(o[anonSym], 'name');
38 verifyNotWritable(o[anonSym], 'name');
39 verifyConfigurable(o[anonSym], 'name');
40
41 assert.sameValue(o[namedSym].name, '[test262]', 'via Symbol');
42 verifyNotEnumerable(o[namedSym], 'name');
43 verifyNotWritable(o[namedSym], 'name');
44 verifyConfigurable(o[namedSym], 'name');