NASHORN-691.js revision 877:cf4d2252d444
178064Sume/* 255009Sshin * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 355009Sshin * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 455009Sshin * 555009Sshin * This code is free software; you can redistribute it and/or modify it 655009Sshin * under the terms of the GNU General Public License version 2 only, as 755009Sshin * published by the Free Software Foundation. 855009Sshin * 955009Sshin * This code is distributed in the hope that it will be useful, but WITHOUT 1055009Sshin * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1155009Sshin * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1255009Sshin * version 2 for more details (a copy is included in the LICENSE file that 1355009Sshin * accompanied this code). 1455009Sshin * 1555009Sshin * You should have received a copy of the GNU General Public License version 1655009Sshin * 2 along with this work; if not, write to the Free Software Foundation, 1755009Sshin * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1855009Sshin * 1955009Sshin * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2055009Sshin * or visit www.oracle.com if you need additional information or have any 2155009Sshin * questions. 2255009Sshin */ 2355009Sshin 2455009Sshin/** 2555009Sshin * NASHORN-691 : Get rid of function id guard 2655009Sshin * 2755009Sshin * @test 2855009Sshin * @run 2955009Sshin */ 30116174Sobrien 3155009Sshinfunction func(x) { 3255009Sshin return function(name) { 3355009Sshin return x; 3455009Sshin } 3555009Sshin}; 3655009Sshin 37116174Sobrienvar delegate = { 38116174Sobrien __get__: func(33) 39116174Sobrien}; 4055009Sshin 4155009Sshinvar x = new JSAdapter(delegate); 4255009Sshin 4355009Sshinfunction f(o) { 4455009Sshin print('o.foo = ' + o.foo); 4555009Sshin} 4655009Sshin 4755009Sshinf(x); 4855009Sshin 4955009Sshin// now change __get__ 5055009Sshindelegate.__get__ = func(44); 5155009Sshinf(x); 5255009Sshin 5355009Sshinvar obj = {}; 5455009Sshinobj.__noSuchProperty__ = func(3); 5555009Sshinf(obj); 5655009Sshinobj.__noSuchProperty__ = func("hello"); 5755009Sshinf(obj); 5855009Sshin