symbol-property.js (911B)
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 es6id: 26.1.7 5 description: > 6 Use a symbol value on property key. 7 info: | 8 26.1.7 Reflect.getOwnPropertyDescriptor ( target, propertyKey ) 9 10 ... 11 2. Let key be ToPropertyKey(propertyKey). 12 ... 13 14 7.1.14 ToPropertyKey ( argument ) 15 16 ... 17 3. If Type(key) is Symbol, then 18 a. Return key. 19 ... 20 includes: [compareArray.js] 21 features: [Reflect, Symbol] 22 ---*/ 23 24 var o = {}; 25 var s = Symbol('42'); 26 o[s] = 42; 27 28 var result = Reflect.getOwnPropertyDescriptor(o, s); 29 30 assert.compareArray( 31 Object.getOwnPropertyNames(result), 32 ['value', 'writable', 'enumerable', 'configurable'] 33 ); 34 assert.sameValue(result.value, 42); 35 assert.sameValue(result.enumerable, true); 36 assert.sameValue(result.configurable, true); 37 assert.sameValue(result.writable, true); 38 39 reportCompare(0, 0);