| 1 |
// This file was procedurally generated from the following sources: |
| 2 |
// - src/dstr-assignment/obj-prop-elem-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 |
AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt |
| 21 |
[...] 7. If Initializer is present and v is undefined and |
| 22 |
IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of |
| 23 |
DestructuringAssignmentTarget are both true, then |
| 24 |
a. Let hasNameProperty be HasOwnProperty(rhsValue, "name"). |
| 25 |
b. ReturnIfAbrupt(hasNameProperty). |
| 26 |
c. If hasNameProperty is false, perform SetFunctionName(rhsValue, |
| 27 |
GetReferencedName(lref)). |
| 28 |
|
| 29 |
---*/ |
| 30 |
var xCls, cls, xCls2; |
| 31 |
|
| 32 |
var result; |
| 33 |
var vals = {}; |
| 34 |
|
| 35 |
result = { x: xCls = class x {}, x: cls = class {}, x: xCls2 = class { static name() {} } } = vals; |
| 36 |
|
| 37 |
assert.notSameValue(xCls.name, 'xCls'); |
| 38 |
assert.notSameValue(xCls2.name, 'xCls2'); |
| 39 |
|
| 40 |
verifyProperty(cls, 'name', { |
| 41 |
enumerable: false, |
| 42 |
writable: false, |
| 43 |
configurable: true, |
| 44 |
value: 'cls' |
| 45 |
}); |
| 46 |
|
| 47 |
assert.sameValue(result, vals); |