Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/assignment/dstr-obj-id-init-fn-name-class.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/dstr-assignment/obj-id-init-fn-name-class.case
3 // - src/dstr-assignment/default/assignment-expr.template
4 /*---
5 description: Assignment of function `name` attribute (ClassExpression) (AssignmentExpression)
6 esid: sec-variable-statement-runtime-semantics-evaluation
7 es6id: 13.3.2.4
8 features: [class, destructuring-binding]
9 flags: [generated]
10 includes: [propertyHelper.js]
11 info: |
12 VariableDeclaration : BindingPattern Initializer
13
14 1. Let rhs be the result of evaluating Initializer.
15 2. Let rval be GetValue(rhs).
16 3. ReturnIfAbrupt(rval).
17 4. Return the result of performing BindingInitialization for
18 BindingPattern passing rval and undefined as arguments.
19
20 AssignmentProperty : IdentifierReference Initializeropt
21 [...] 6. If Initializeropt is present and v is undefined, then
22 [...]
23 d. If IsAnonymousFunctionDefinition(Initializer) is true, then
24 i. Let hasNameProperty be HasOwnProperty(v, "name").
25 ii. ReturnIfAbrupt(hasNameProperty).
26 iii. If hasNameProperty is false, perform SetFunctionName(v, P).
27
28 ---*/
29 var xCls, cls, xCls2;
30
31 var result;
32 var vals = {};
33
34 result = { xCls = class x {}, cls = class {}, xCls2 = class { static name() {} } } = vals;
35
36 assert.notSameValue(xCls.name, 'xCls');
37 assert.notSameValue(xCls2.name, 'xCls2');
38
39 verifyProperty(cls, 'name', {
40 enumerable: false,
41 writable: false,
42 configurable: true,
43 value: 'cls'
44 });
45
46 assert.sameValue(result, vals);