Revision control

Copy as Markdown

// 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
es6id: 12.2.6.8
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');