obj-id-init-fn-name-class.js (1534B)
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 features: [class, destructuring-binding] 8 flags: [generated] 9 includes: [propertyHelper.js] 10 info: | 11 VariableDeclaration : BindingPattern Initializer 12 13 1. Let rhs be the result of evaluating Initializer. 14 2. Let rval be GetValue(rhs). 15 3. ReturnIfAbrupt(rval). 16 4. Return the result of performing BindingInitialization for 17 BindingPattern passing rval and undefined as arguments. 18 19 AssignmentProperty : IdentifierReference Initializeropt 20 [...] 6. If Initializeropt is present and v is undefined, then 21 [...] 22 d. If IsAnonymousFunctionDefinition(Initializer) is true, then 23 i. Let hasNameProperty be HasOwnProperty(v, "name"). 24 ii. ReturnIfAbrupt(hasNameProperty). 25 iii. If hasNameProperty is false, perform SetFunctionName(v, P). 26 27 ---*/ 28 var xCls, cls, xCls2; 29 30 var result; 31 var vals = {}; 32 33 result = { xCls = class x {}, cls = class {}, xCls2 = class { static name() {} } } = vals; 34 35 assert.notSameValue(xCls.name, 'xCls'); 36 assert.notSameValue(xCls2.name, 'xCls2'); 37 38 verifyProperty(cls, 'name', { 39 enumerable: false, 40 writable: false, 41 configurable: true, 42 value: 'cls' 43 }); 44 45 assert.sameValue(result, vals); 46 47 reportCompare(0, 0);