hannesw@1507: /* hannesw@1507: * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. hannesw@1507: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. hannesw@1507: * hannesw@1507: * This code is free software; you can redistribute it and/or modify it hannesw@1507: * under the terms of the GNU General Public License version 2 only, as hannesw@1507: * published by the Free Software Foundation. hannesw@1507: * hannesw@1507: * This code is distributed in the hope that it will be useful, but WITHOUT hannesw@1507: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or hannesw@1507: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License hannesw@1507: * version 2 for more details (a copy is included in the LICENSE file that hannesw@1507: * accompanied this code). hannesw@1507: * hannesw@1507: * You should have received a copy of the GNU General Public License version hannesw@1507: * 2 along with this work; if not, write to the Free Software Foundation, hannesw@1507: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. hannesw@1507: * hannesw@1507: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA hannesw@1507: * or visit www.oracle.com if you need additional information or have any hannesw@1507: * questions. hannesw@1507: */ hannesw@1507: hannesw@1507: /** hannesw@1507: * JDK-8131683: Delete fails over multiple scopes hannesw@1507: * hannesw@1507: * @test hannesw@1507: * @run hannesw@1507: */ hannesw@1507: hannesw@1507: a = 1; hannesw@1507: b = 2; hannesw@1507: c = 3; hannesw@1507: hannesw@1507: var A = 1; hannesw@1507: var B = 2; hannesw@1507: var C = 3; hannesw@1507: function D() {} hannesw@1507: hannesw@1507: print((function() { hannesw@1507: var x; // force creation of scope hannesw@1507: (function() { x; })(); hannesw@1507: return delete a; hannesw@1507: })()); hannesw@1507: hannesw@1507: print((function() { hannesw@1507: eval(""); hannesw@1507: return delete b; hannesw@1507: })()); hannesw@1507: hannesw@1507: print((function() { hannesw@1507: return eval("delete c"); hannesw@1507: })()); hannesw@1507: hannesw@1507: print((function() { hannesw@1507: eval("d = 4"); hannesw@1507: return eval("delete d"); hannesw@1507: })()); hannesw@1507: hannesw@1507: print(typeof a); hannesw@1507: print(typeof b); hannesw@1507: print(typeof c); hannesw@1507: print(typeof d); hannesw@1507: hannesw@1507: print((function() { hannesw@1507: var x; // force creation of scope hannesw@1507: (function() { x; })(); hannesw@1507: return delete A; hannesw@1507: })()); hannesw@1507: hannesw@1507: print((function() { hannesw@1507: eval(""); hannesw@1507: return delete B; hannesw@1507: })()); hannesw@1507: hannesw@1507: print((function() { hannesw@1507: return eval("delete C"); hannesw@1507: })()); hannesw@1507: hannesw@1507: print((function() { hannesw@1507: eval(""); hannesw@1507: return delete D; hannesw@1507: })()); hannesw@1507: hannesw@1507: print(typeof A); hannesw@1507: print(typeof B); hannesw@1507: print(typeof C); hannesw@1507: print(typeof D); hannesw@1507: