NASHORN-425.js revision 877:cf4d2252d444
150128Swpaul/* 250128Swpaul * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 350128Swpaul * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 450128Swpaul * 550128Swpaul * This code is free software; you can redistribute it and/or modify it 650128Swpaul * under the terms of the GNU General Public License version 2 only, as 750128Swpaul * published by the Free Software Foundation. 850128Swpaul * 950128Swpaul * This code is distributed in the hope that it will be useful, but WITHOUT 1050128Swpaul * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1150128Swpaul * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1250128Swpaul * version 2 for more details (a copy is included in the LICENSE file that 1350128Swpaul * accompanied this code). 1450128Swpaul * 1550128Swpaul * You should have received a copy of the GNU General Public License version 1650128Swpaul * 2 along with this work; if not, write to the Free Software Foundation, 1750128Swpaul * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1850128Swpaul * 1950128Swpaul * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2050128Swpaul * or visit www.oracle.com if you need additional information or have any 2150128Swpaul * questions. 2250128Swpaul */ 2350128Swpaul 2450128Swpaul/* 2550128Swpaul * NASHORN-425 : can't asynchronously call an immediately-executed function. 2650128Swpaul * 2750128Swpaul * @test 2850128Swpaul * @run 2950128Swpaul */ 3050128Swpaul 3150128Swpaulfunction callback(cb) { 3250477Speter cb() 3350128Swpaul} 3450128Swpaul 3550128Swpaul(function E (ii, ll) { 3650128Swpaul print(ii + "," + ll); 3750128Swpaul if (ii === ll) { 3850128Swpaul return; 3950128Swpaul } 4050128Swpaul callback(function() { 4150128Swpaul return E(ii + 1, ll) 4250128Swpaul }); 4350128Swpaul})(0, 2) 4450128Swpaul 4550128Swpaul