test/script/basic/JDK-8131683.js

Tue, 21 Mar 2017 13:41:57 -0700

author
asaha
date
Tue, 21 Mar 2017 13:41:57 -0700
changeset 2160
1df40fe54cd6
parent 1507
61b5174f7bf1
permissions
-rw-r--r--

Merge

hannesw@1507 1 /*
hannesw@1507 2 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
hannesw@1507 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
hannesw@1507 4 *
hannesw@1507 5 * This code is free software; you can redistribute it and/or modify it
hannesw@1507 6 * under the terms of the GNU General Public License version 2 only, as
hannesw@1507 7 * published by the Free Software Foundation.
hannesw@1507 8 *
hannesw@1507 9 * This code is distributed in the hope that it will be useful, but WITHOUT
hannesw@1507 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
hannesw@1507 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
hannesw@1507 12 * version 2 for more details (a copy is included in the LICENSE file that
hannesw@1507 13 * accompanied this code).
hannesw@1507 14 *
hannesw@1507 15 * You should have received a copy of the GNU General Public License version
hannesw@1507 16 * 2 along with this work; if not, write to the Free Software Foundation,
hannesw@1507 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
hannesw@1507 18 *
hannesw@1507 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
hannesw@1507 20 * or visit www.oracle.com if you need additional information or have any
hannesw@1507 21 * questions.
hannesw@1507 22 */
hannesw@1507 23
hannesw@1507 24 /**
hannesw@1507 25 * JDK-8131683: Delete fails over multiple scopes
hannesw@1507 26 *
hannesw@1507 27 * @test
hannesw@1507 28 * @run
hannesw@1507 29 */
hannesw@1507 30
hannesw@1507 31 a = 1;
hannesw@1507 32 b = 2;
hannesw@1507 33 c = 3;
hannesw@1507 34
hannesw@1507 35 var A = 1;
hannesw@1507 36 var B = 2;
hannesw@1507 37 var C = 3;
hannesw@1507 38 function D() {}
hannesw@1507 39
hannesw@1507 40 print((function() {
hannesw@1507 41 var x; // force creation of scope
hannesw@1507 42 (function() { x; })();
hannesw@1507 43 return delete a;
hannesw@1507 44 })());
hannesw@1507 45
hannesw@1507 46 print((function() {
hannesw@1507 47 eval("");
hannesw@1507 48 return delete b;
hannesw@1507 49 })());
hannesw@1507 50
hannesw@1507 51 print((function() {
hannesw@1507 52 return eval("delete c");
hannesw@1507 53 })());
hannesw@1507 54
hannesw@1507 55 print((function() {
hannesw@1507 56 eval("d = 4");
hannesw@1507 57 return eval("delete d");
hannesw@1507 58 })());
hannesw@1507 59
hannesw@1507 60 print(typeof a);
hannesw@1507 61 print(typeof b);
hannesw@1507 62 print(typeof c);
hannesw@1507 63 print(typeof d);
hannesw@1507 64
hannesw@1507 65 print((function() {
hannesw@1507 66 var x; // force creation of scope
hannesw@1507 67 (function() { x; })();
hannesw@1507 68 return delete A;
hannesw@1507 69 })());
hannesw@1507 70
hannesw@1507 71 print((function() {
hannesw@1507 72 eval("");
hannesw@1507 73 return delete B;
hannesw@1507 74 })());
hannesw@1507 75
hannesw@1507 76 print((function() {
hannesw@1507 77 return eval("delete C");
hannesw@1507 78 })());
hannesw@1507 79
hannesw@1507 80 print((function() {
hannesw@1507 81 eval("");
hannesw@1507 82 return delete D;
hannesw@1507 83 })());
hannesw@1507 84
hannesw@1507 85 print(typeof A);
hannesw@1507 86 print(typeof B);
hannesw@1507 87 print(typeof C);
hannesw@1507 88 print(typeof D);
hannesw@1507 89

mercurial