newnew.js revision 6:5a1b0714df0e
1169691Skan/* 2169691Skan * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 3169691Skan * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4169691Skan * 5169691Skan * This code is free software; you can redistribute it and/or modify it 6169691Skan * under the terms of the GNU General Public License version 2 only, as 7169691Skan * published by the Free Software Foundation. 8169691Skan * 9169691Skan * This code is distributed in the hope that it will be useful, but WITHOUT 10169691Skan * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11169691Skan * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12169691Skan * version 2 for more details (a copy is included in the LICENSE file that 13169691Skan * accompanied this code). 14169691Skan * 15169691Skan * You should have received a copy of the GNU General Public License version 16169691Skan * 2 along with this work; if not, write to the Free Software Foundation, 17169691Skan * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18169691Skan * 19169691Skan * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20169691Skan * or visit www.oracle.com if you need additional information or have any 21169691Skan * questions. 22169691Skan */ 23169691Skan 24169691Skan/** 25169691Skan * New new function tests. 26169691Skan * 27169691Skan * @test 28169691Skan * @run 29169691Skan */ 30169691Skan 31169691Skanfunction myObject() { 32169691Skan this.x = 10; 33169691Skan this.y = 20; 34169691Skan this.z = 30; 35169691Skan} 36169691Skan 37169691Skanfunction proxyObject() { 38169691Skan return myObject; 39169691Skan} 40169691Skan 41169691Skanvar obj1 = new myObject(); 42169691Skanvar obj2 = new new proxyObject(); 43169691Skanvar obj3 = new proxyObject(); 44169691Skan 45169691Skanfor (i in obj1) print(i, obj1[i]); 46169691Skanfor (i in obj2) print(i, obj2[i]); 47169691Skanfor (i in obj3) print(i, obj3[i]); 48169691Skan 49169691Skan