Debian Codegraph @

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