hannesw@1105: /* hannesw@1105: * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. hannesw@1105: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. hannesw@1105: * hannesw@1105: * This code is free software; you can redistribute it and/or modify it hannesw@1105: * under the terms of the GNU General Public License version 2 only, as hannesw@1105: * published by the Free Software Foundation. hannesw@1105: * hannesw@1105: * This code is distributed in the hope that it will be useful, but WITHOUT hannesw@1105: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or hannesw@1105: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License hannesw@1105: * version 2 for more details (a copy is included in the LICENSE file that hannesw@1105: * accompanied this code). hannesw@1105: * hannesw@1105: * You should have received a copy of the GNU General Public License version hannesw@1105: * 2 along with this work; if not, write to the Free Software Foundation, hannesw@1105: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. hannesw@1105: * hannesw@1105: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA hannesw@1105: * or visit www.oracle.com if you need additional information or have any hannesw@1105: * questions. hannesw@1105: */ hannesw@1105: hannesw@1105: /** hannesw@1105: * JDK-8057691: Nashorn: let & const declarations are not shared between scripts hannesw@1105: * hannesw@1105: * @subtest hannesw@1105: */ hannesw@1105: hannesw@1105: print(VAR); hannesw@1105: print(LET); hannesw@1105: print(CONST); hannesw@1105: print(FUNC); hannesw@1105: print(GLOBAL); hannesw@1105: print(this.VAR); hannesw@1105: print(this.LET); // undefined hannesw@1105: print(this.CONST); // undefined hannesw@1105: print(this.FUNC); hannesw@1105: print(this.GLOBAL); hannesw@1105: print("VAR" in this); hannesw@1105: print("LET" in this); // false hannesw@1105: print("CONST" in this); // false hannesw@1105: print("FUNC" in this); hannesw@1105: print("GLOBAL" in this); hannesw@1105: hannesw@1105: try { hannesw@1105: LET = LET + "LET"; hannesw@1105: CONST = CONST + "CONST"; hannesw@1105: } catch (e) { hannesw@1105: print(String(e).replace(/\\/g, "/")); hannesw@1105: }