Thu, 17 Mar 2016 08:10:13 -0700
Added tag jdk8u91-b00 for changeset a2c005a7b33a
hannesw@1109 | 1 | /* |
hannesw@1109 | 2 | * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
hannesw@1109 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
hannesw@1109 | 4 | * |
hannesw@1109 | 5 | * This code is free software; you can redistribute it and/or modify it |
hannesw@1109 | 6 | * under the terms of the GNU General Public License version 2 only, as |
hannesw@1109 | 7 | * published by the Free Software Foundation. |
hannesw@1109 | 8 | * |
hannesw@1109 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
hannesw@1109 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
hannesw@1109 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
hannesw@1109 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
hannesw@1109 | 13 | * accompanied this code). |
hannesw@1109 | 14 | * |
hannesw@1109 | 15 | * You should have received a copy of the GNU General Public License version |
hannesw@1109 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
hannesw@1109 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
hannesw@1109 | 18 | * |
hannesw@1109 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
hannesw@1109 | 20 | * or visit www.oracle.com if you need additional information or have any |
hannesw@1109 | 21 | * questions. |
hannesw@1109 | 22 | */ |
hannesw@1109 | 23 | |
hannesw@1109 | 24 | /** |
hannesw@1109 | 25 | * JDK-8057980: let & const: remaining issues with lexical scoping |
hannesw@1109 | 26 | * |
hannesw@1109 | 27 | * @test |
hannesw@1109 | 28 | * @run |
hannesw@1109 | 29 | * @option --language=es6 |
hannesw@1109 | 30 | */ |
hannesw@1109 | 31 | |
hannesw@1109 | 32 | function tryEval(s) { |
hannesw@1109 | 33 | try { |
hannesw@1109 | 34 | eval(s); |
hannesw@1109 | 35 | } catch (e) { |
hannesw@1109 | 36 | print(String(e).replace(/\\/g, "/")); |
hannesw@1109 | 37 | } |
hannesw@1109 | 38 | } |
hannesw@1109 | 39 | |
hannesw@1109 | 40 | tryEval('if (true) let x = 1;'); |
hannesw@1109 | 41 | tryEval('if (true) const x = 1;'); |
hannesw@1109 | 42 | tryEval('while (true) let x = 1;'); |
hannesw@1109 | 43 | tryEval('while (true) const x = 1;'); |
hannesw@1109 | 44 | tryEval('for (;;) let x = 1;'); |
hannesw@1109 | 45 | tryEval('for (;;) const x = 1;'); |
hannesw@1109 | 46 | tryEval('do let x = 1; while (true);'); |
hannesw@1109 | 47 | tryEval('do const x = 1; while (true);'); |
hannesw@1109 | 48 | tryEval('with (y) const x = 1;'); |
hannesw@1109 | 49 | tryEval('with (y) let x = 1;'); |