| // Copyright (C) 2017 Mike Pennisi. All rights reserved. |
| // This code is governed by the BSD license found in the LICENSE file. |
| /*--- |
| path: language/expressions/object/accessor-name- |
| name: Object initializer |
| esid: sec-object-initializer-runtime-semantics-evaluation |
| info: | |
| ObjectLiteral : |
| { PropertyDefinitionList } |
| { PropertyDefinitionList , } |
| |
| 1. Let obj be ObjectCreate(%ObjectPrototype%). |
| 2. Let status be the result of performing PropertyDefinitionEvaluation of |
| PropertyDefinitionList with arguments obj and true. |
| ---*/ |
| |
| var stringSet; |
| var obj = { |
| get [/*{ declareWith }*/]() { return 'get string'; }, |
| set [/*{ declareWith }*/](param) { stringSet = param; } |
| }; |
| |
| assert.sameValue(obj[/*{ referenceWith }*/], 'get string'); |
| |
| obj[/*{ referenceWith }*/] = 'set string'; |
| assert.sameValue(stringSet, 'set string'); |