fn-name-class.js (1150B)
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: 12.2.6.9 6 description: Assignment of function `name` attribute (ClassExpression) 7 info: | 8 6. If IsAnonymousFunctionDefinition(AssignmentExpression) is true, then 9 a. Let hasNameProperty be HasOwnProperty(propValue, "name"). 10 b. ReturnIfAbrupt(hasNameProperty). 11 c. If hasNameProperty is false, perform SetFunctionName(propValue, 12 propKey). 13 includes: [propertyHelper.js] 14 features: [class, Symbol] 15 ---*/ 16 17 var namedSym = Symbol('test262'); 18 var anonSym = Symbol(); 19 var o; 20 21 o = { 22 xId: class x {}, 23 id: class {}, 24 [anonSym]: class {}, 25 [namedSym]: class {} 26 }; 27 28 assert(o.xId.name !== 'xId'); 29 30 verifyProperty(o.id, 'name', { 31 value: 'id', 32 writable: false, 33 enumerable: false, 34 configurable: true, 35 }); 36 37 verifyProperty(o[anonSym], 'name', { 38 value: '', 39 writable: false, 40 enumerable: false, 41 configurable: true, 42 }); 43 44 verifyProperty(o[namedSym], 'name', { 45 value: '[test262]', 46 writable: false, 47 enumerable: false, 48 configurable: true, 49 }); 50 51 reportCompare(0, 0);