| 1 |
// Copyright (C) 2016 the V8 project authors. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
/*--- |
| 4 |
esid: sec-object-initializer-runtime-semantics-evaluation |
| 5 |
es6id: 12.2.6.8 |
| 6 |
description: Property descriptor of "set" accessor methods |
| 7 |
info: | |
| 8 |
ObjectLiteral: |
| 9 |
{ PropertyDefinitionList } |
| 10 |
{ PropertyDefinitionList , } |
| 11 |
|
| 12 |
1. Let obj be ObjectCreate(%ObjectPrototype%). |
| 13 |
2. Let status be the result of performing PropertyDefinitionEvaluation of |
| 14 |
PropertyDefinitionList with arguments obj and true. |
| 15 |
3. ReturnIfAbrupt(status). |
| 16 |
4. Return obj. |
| 17 |
|
| 18 |
14.3.8 Runtime Semantics: PropertyDefinitionEvaluation |
| 19 |
|
| 20 |
MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } |
| 21 |
|
| 22 |
[...] |
| 23 |
8. Let desc be the PropertyDescriptor{[[Set]]: closure, [[Enumerable]]: |
| 24 |
enumerable, [[Configurable]]: true}. |
| 25 |
[...] |
| 26 |
includes: [propertyHelper.js] |
| 27 |
---*/ |
| 28 |
|
| 29 |
var obj = { set m(x) { return x; } }; |
| 30 |
var desc = Object.getOwnPropertyDescriptor(obj, 'm'); |
| 31 |
|
| 32 |
verifyEnumerable(obj, 'm'); |
| 33 |
verifyConfigurable(obj, 'm'); |
| 34 |
assert.sameValue(desc.value, undefined, '`value` field'); |
| 35 |
assert.sameValue(desc.get, undefined, '`get` field'); |
| 36 |
assert.sameValue(typeof desc.set, 'function', 'type of `set` field'); |
| 37 |
assert.sameValue(desc.set(436), 436, '`set` function return value'); |