newnew.js revision 877:cf4d2252d444
115103Sphk/* 215103Sphk * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 315103Sphk * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 415103Sphk * 515103Sphk * This code is free software; you can redistribute it and/or modify it 615103Sphk * under the terms of the GNU General Public License version 2 only, as 715103Sphk * published by the Free Software Foundation. 815103Sphk * 915103Sphk * This code is distributed in the hope that it will be useful, but WITHOUT 1015103Sphk * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1115103Sphk * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1215103Sphk * version 2 for more details (a copy is included in the LICENSE file that 1315103Sphk * accompanied this code). 1415103Sphk * 1515103Sphk * You should have received a copy of the GNU General Public License version 1615103Sphk * 2 along with this work; if not, write to the Free Software Foundation, 1715103Sphk * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1815103Sphk * 1915103Sphk * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2015103Sphk * or visit www.oracle.com if you need additional information or have any 2115103Sphk * questions. 2215103Sphk */ 2315103Sphk 2415103Sphk/** 2515103Sphk * New new function tests. 2615103Sphk * 2715103Sphk * @test 2815103Sphk * @run 2915103Sphk */ 3015103Sphk 3115103Sphkfunction myObject() { 3215103Sphk this.x = 10; 3315103Sphk this.y = 20; 3415103Sphk this.z = 30; 3515103Sphk} 3615103Sphk 3715103Sphkfunction proxyObject() { 38116182Sobrien return myObject; 39116182Sobrien} 40116182Sobrien 4186190Srwatsonvar obj1 = new myObject(); 42169604Swkoszekvar obj2 = new new proxyObject(); 4384611Srwatsonvar obj3 = new proxyObject(); 4415103Sphk 4515103Sphkfor (i in obj1) print(i, obj1[i]); 46169507Swkoszekfor (i in obj2) print(i, obj2[i]); 4715103Sphkfor (i in obj3) print(i, obj3[i]); 4815103Sphk 4915103Sphk