setter.js (655B)
1 // Copyright (C) 2014 the V8 project authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 /*--- 4 es6id: 12.2.5 5 description: > 6 In an object, duplicate computed property getter names produce only a single property of 7 that name, whose value is the value of the last property of that name. 8 ---*/ 9 var calls = 0; 10 var s = Symbol(); 11 var A = { 12 set ['a'](_) { 13 calls++; 14 }, 15 set [1](_) { 16 calls++; 17 }, 18 set [s](_) { 19 calls++; 20 } 21 }; 22 A.a = 'A'; 23 A[1] = 1; 24 A[s] = s; 25 assert.sameValue(calls, 3, "The value of `calls` is `1`, after executing `A.a = 'A'; A[1] = 1; A[s] = s;`"); 26 27 reportCompare(0, 0);