Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/object/fn-name-arrow.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 (ArrowFunction)
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 assert.sameValue(o.id.name, 'id', 'via IdentifierName');
28 verifyNotEnumerable(o.id, 'name');
29 verifyNotWritable(o.id, 'name');
30 verifyConfigurable(o.id, 'name');
31
32 assert.sameValue(o[anonSym].name, '', 'via anonymous Symbol');
33 verifyNotEnumerable(o[anonSym], 'name');
34 verifyNotWritable(o[anonSym], 'name');
35 verifyConfigurable(o[anonSym], 'name');
36
37 assert.sameValue(o[namedSym].name, '[test262]', 'via Symbol');
38 verifyNotEnumerable(o[namedSym], 'name');
39 verifyNotWritable(o[namedSym], 'name');
40 verifyConfigurable(o[namedSym], 'name');