computed-property-setter.js revision 1779:4a6ee1185fc8
119370Spst/* 219370Spst * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. 319370Spst * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 419370Spst * 519370Spst * This code is free software; you can redistribute it and/or modify it 619370Spst * under the terms of the GNU General Public License version 2 only, as 719370Spst * published by the Free Software Foundation. 819370Spst * 919370Spst * This code is distributed in the hope that it will be useful, but WITHOUT 1019370Spst * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1119370Spst * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1219370Spst * version 2 for more details (a copy is included in the LICENSE file that 1319370Spst * accompanied this code). 1419370Spst * 1519370Spst * You should have received a copy of the GNU General Public License version 1619370Spst * 2 along with this work; if not, write to the Free Software Foundation, 1719370Spst * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1819370Spst * 1919370Spst * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2019370Spst * or visit www.oracle.com if you need additional information or have any 2119370Spst * questions. 2219370Spst */ 2319370Spst 2419370Spst/** 2519370Spst * JDK-8164467: ES6 computed properties are implemented wrongly 2619370Spst * 2719370Spst * @test 2819370Spst * @run 2919370Spst * @option --language=es6 3019370Spst */ 3119370Spst 3219370Spstvar counter = 0; 3319370Spst 3419370Spstvar obj = { 3519370Spst set ['a'](x) { 3619370Spst counter++; 3719370Spst } 3819370Spst}; 3919370Spst 4019370Spstobj.a = 'a'; 4119370SpstAssert.assertTrue(counter === 1); 4219370Spstobj.a = 'a'; 4319370SpstAssert.assertTrue(counter === 2); 4419370Spst