blob: fb8e518721207f58e9ba7cd74a9f89c37baa6e6f [file] [log] [blame] [edit]
// 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');