test/script/basic/JDK-8134488.js

Tue, 05 Jan 2016 18:40:43 +0530

author
sundar
date
Tue, 05 Jan 2016 18:40:43 +0530
changeset 1894
de5fdc537134
parent 1827
1bd585e65406
permissions
-rw-r--r--

8146240: Three nashorn files contain "GNU General Public License" header
Reviewed-by: jlaskey

attila@1551 1 /*
sundar@1827 2 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
attila@1551 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
attila@1551 4 *
attila@1551 5 * This code is free software; you can redistribute it and/or modify it
attila@1551 6 * under the terms of the GNU General Public License version 2 only, as
attila@1551 7 * published by the Free Software Foundation.
attila@1551 8 *
attila@1551 9 * This code is distributed in the hope that it will be useful, but WITHOUT
attila@1551 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
attila@1551 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
attila@1551 12 * version 2 for more details (a copy is included in the LICENSE file that
attila@1551 13 * accompanied this code).
attila@1551 14 *
attila@1551 15 * You should have received a copy of the GNU General Public License version
attila@1551 16 * 2 along with this work; if not, write to the Free Software Foundation,
attila@1551 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
attila@1551 18 *
attila@1551 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
attila@1551 20 * or visit www.oracle.com if you need additional information or have any
attila@1551 21 * questions.
attila@1551 22 */
attila@1551 23
attila@1551 24 /**
attila@1551 25 * JDK-8134488: var statement in if(false) block incorrectly evacuated into enclosing function
attila@1551 26 *
attila@1551 27 * @test
attila@1551 28 * @run
attila@1551 29 */
attila@1551 30
attila@1551 31 var x = "string";
attila@1551 32 print(x);
attila@1551 33
attila@1551 34 (function f1() {
attila@1551 35 (function f2() {
attila@1551 36 // If it finds both 'print' and 'x', it'll print 'string'.
attila@1551 37 print(x);
attila@1551 38 })();
attila@1551 39
attila@1551 40 if (false) {
attila@1551 41 (function f3() {
attila@1551 42 var x;
attila@1551 43 })();
attila@1551 44 }
attila@1551 45
attila@1551 46 })();

mercurial