Tue, 03 Nov 2015 07:19:18 -0800
Added tag jdk8u66-b33 for changeset 3629a9cd6627
hannesw@991 | 1 | /* |
hannesw@991 | 2 | * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. |
hannesw@991 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
hannesw@991 | 4 | * |
hannesw@991 | 5 | * This code is free software; you can redistribute it and/or modify it |
hannesw@991 | 6 | * under the terms of the GNU General Public License version 2 only, as |
hannesw@991 | 7 | * published by the Free Software Foundation. |
hannesw@991 | 8 | * |
hannesw@991 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
hannesw@991 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
hannesw@991 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
hannesw@991 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
hannesw@991 | 13 | * accompanied this code). |
hannesw@991 | 14 | * |
hannesw@991 | 15 | * You should have received a copy of the GNU General Public License version |
hannesw@991 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
hannesw@991 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
hannesw@991 | 18 | * |
hannesw@991 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
hannesw@991 | 20 | * or visit www.oracle.com if you need additional information or have any |
hannesw@991 | 21 | * questions. |
hannesw@991 | 22 | */ |
hannesw@991 | 23 | |
hannesw@991 | 24 | /** |
hannesw@991 | 25 | * JDK-8051889: Implement block scoping in symbol assignment and scope computation |
hannesw@991 | 26 | * |
hannesw@991 | 27 | * @test |
hannesw@991 | 28 | * @run |
hannesw@1127 | 29 | * @option --language=es6 |
hannesw@1127 | 30 | */ |
hannesw@991 | 31 | |
hannesw@991 | 32 | "use strict"; |
hannesw@991 | 33 | |
hannesw@991 | 34 | for (let i = 0; i < 10; i++) { |
hannesw@991 | 35 | print(i); |
hannesw@991 | 36 | } |
hannesw@991 | 37 | |
hannesw@991 | 38 | try { |
hannesw@991 | 39 | print(i); |
hannesw@991 | 40 | } catch (e) { |
hannesw@991 | 41 | print(e); |
hannesw@991 | 42 | } |
hannesw@1109 | 43 | |
hannesw@1109 | 44 | let a = []; |
hannesw@1109 | 45 | |
hannesw@1109 | 46 | for (let i = 0; i < 10; i++) { |
hannesw@1109 | 47 | a.push(function() { print(i); }); |
hannesw@1109 | 48 | } |
hannesw@1109 | 49 | |
hannesw@1109 | 50 | a.forEach(function(f) { f(); }); |
hannesw@1109 | 51 | |
hannesw@1109 | 52 | a = []; |
hannesw@1109 | 53 | |
hannesw@1109 | 54 | for (let i = 0; i < 10; i++) { |
hannesw@1109 | 55 | if (i == 5) { |
hannesw@1109 | 56 | i = "foo"; |
hannesw@1109 | 57 | } |
hannesw@1109 | 58 | a.push(function() { print(i); }); |
hannesw@1109 | 59 | } |
hannesw@1109 | 60 | |
hannesw@1109 | 61 | a.forEach(function(f) { f(); }); |
hannesw@1109 | 62 | |
hannesw@1109 | 63 | try { |
hannesw@1109 | 64 | print(i); |
hannesw@1109 | 65 | } catch (e) { |
hannesw@1109 | 66 | print(e); |
hannesw@1109 | 67 | } |
hannesw@1109 | 68 | |
hannesw@1109 | 69 | a = []; |
hannesw@1109 | 70 | |
hannesw@1109 | 71 | for (let i = 0; i < 20; i++) { |
hannesw@1109 | 72 | if (i % 2 == 1) { |
hannesw@1109 | 73 | i += 2; |
hannesw@1109 | 74 | continue; |
hannesw@1109 | 75 | } |
hannesw@1109 | 76 | a.push(function() { print(i); }); |
hannesw@1109 | 77 | } |
hannesw@1109 | 78 | |
hannesw@1109 | 79 | a.forEach(function(f) { f(); }); |