Debian Codegraph @

js/src/tests/test262/language/statements/const/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: 13.3.1.4
6 description: >
7 Assignment of function `name` attribute (CoverParenthesizedExpression)
8 info: |
9 LexicalBinding : BindingIdentifier Initializer
10
11 [...]
12 6. If IsAnonymousFunctionDefinition(Initializer) is true, then
13 a. Let hasNameProperty be HasOwnProperty(value, "name").
14 b. ReturnIfAbrupt(hasNameProperty).
15 c. If hasNameProperty is false, perform SetFunctionName(value,
16 bindingId).
17 includes: [propertyHelper.js]
18 ---*/
19
20 const xCover = (0, function() {});
21 const cover = (function() {});
22
23 assert(xCover.name !== 'xCover');
24
25 verifyProperty(cover, 'name', {
26 value: 'cover',
27 writable: false,
28 enumerable: false,
29 configurable: true,
30 });
31
32 reportCompare(0, 0);