2015-07-29 23:00:49 +02:00
|
|
|
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
|
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
|
|
/*---
|
|
|
|
es6id: 26.1.7
|
|
|
|
description: >
|
|
|
|
Use a symbol value on property key.
|
2018-01-05 18:26:51 +01:00
|
|
|
info: |
|
2015-07-29 23:00:49 +02:00
|
|
|
26.1.7 Reflect.getOwnPropertyDescriptor ( target, propertyKey )
|
|
|
|
|
|
|
|
...
|
|
|
|
2. Let key be ToPropertyKey(propertyKey).
|
|
|
|
...
|
|
|
|
|
|
|
|
7.1.14 ToPropertyKey ( argument )
|
|
|
|
|
|
|
|
...
|
|
|
|
3. If Type(key) is Symbol, then
|
|
|
|
a. Return key.
|
|
|
|
...
|
|
|
|
includes: [compareArray.js]
|
2018-07-21 00:42:39 +02:00
|
|
|
features: [Reflect, Symbol]
|
2015-07-29 23:00:49 +02:00
|
|
|
---*/
|
|
|
|
|
|
|
|
var o = {};
|
|
|
|
var s = Symbol('42');
|
|
|
|
o[s] = 42;
|
|
|
|
|
|
|
|
var result = Reflect.getOwnPropertyDescriptor(o, s);
|
|
|
|
|
2021-10-06 04:33:22 +02:00
|
|
|
assert.compareArray(
|
|
|
|
Object.getOwnPropertyNames(result),
|
|
|
|
['value', 'writable', 'enumerable', 'configurable']
|
2015-07-29 23:00:49 +02:00
|
|
|
);
|
2021-10-01 03:57:16 +02:00
|
|
|
assert.sameValue(result.value, 42);
|
|
|
|
assert.sameValue(result.enumerable, true);
|
|
|
|
assert.sameValue(result.configurable, true);
|
|
|
|
assert.sameValue(result.writable, true);
|