NASHORN-658.js revision 6:5a1b0714df0e
1275970Scy/* 2275970Scy * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 3275970Scy * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4275970Scy * 5275970Scy * This code is free software; you can redistribute it and/or modify it 6275970Scy * under the terms of the GNU General Public License version 2 only, as 7275970Scy * published by the Free Software Foundation. 8275970Scy * 9275970Scy * This code is distributed in the hope that it will be useful, but WITHOUT 10275970Scy * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11275970Scy * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12275970Scy * version 2 for more details (a copy is included in the LICENSE file that 13275970Scy * accompanied this code). 14275970Scy * 15275970Scy * You should have received a copy of the GNU General Public License version 16275970Scy * 2 along with this work; if not, write to the Free Software Foundation, 17275970Scy * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18275970Scy * 19275970Scy * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20275970Scy * or visit www.oracle.com if you need additional information or have any 21275970Scy * questions. 22275970Scy */ 23275970Scy 24275970Scy/* 25275970Scy * NASHORN-658: nasgen generated constructor functions all have function id 0. 26275970Scy * 27275970Scy * @test 28275970Scy * @run 29275970Scy */ 30275970Scy 31275970Scyfunction C1() {} 32275970Scyfunction C2() {} 33275970Scyfunction C3() {} 34275970Scy 35275970Scyvar ctors = [C1,C2,Number,String,Date,C3]; 36275970Scy 37275970Scy(function() { 38275970Scyfor (var i in ctors) { 39275970Scy var c = ctors[i]; 40275970Scy if (new c().constructor !== c) { 41275970Scy throw "Error: new c().constructor !== c"; 42275970Scy } 43275970Scy} 44275970Scy})(); 45275970Scy 46