condassign.js revision 877:cf4d2252d444
1251875Speter/* 2251875Speter * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 3251875Speter * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4251875Speter * 5251875Speter * This code is free software; you can redistribute it and/or modify it 6251875Speter * under the terms of the GNU General Public License version 2 only, as 7251875Speter * published by the Free Software Foundation. 8251875Speter * 9251875Speter * This code is distributed in the hope that it will be useful, but WITHOUT 10251875Speter * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11251875Speter * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12251875Speter * version 2 for more details (a copy is included in the LICENSE file that 13251875Speter * accompanied this code). 14251875Speter * 15251875Speter * You should have received a copy of the GNU General Public License version 16251875Speter * 2 along with this work; if not, write to the Free Software Foundation, 17251875Speter * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18251875Speter * 19251875Speter * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20251875Speter * or visit www.oracle.com if you need additional information or have any 21251875Speter * questions. 22251875Speter */ 23251875Speter 24251875Speter/** 25251875Speter * Used to result in error: "Expected : but found =". 26251875Speter * Assignment should be allowed in conditional expression arms. 27251875Speter * 28251875Speter * @test 29251875Speter * @run 30251875Speter */ 31251875Speter 32251875Spetervar x = 3; 33251875Spetervar y = x ? x = 55 : 5465; 34251875Speterprint(y); 35251875Spetervar y = x ? 6 : x += 3; 36251875Speterprint(x); 37251875Speter