NASHORN-40.js revision 2:da1e581c933b
139225Sgibbs/*
239225Sgibbs * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
339225Sgibbs * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
439225Sgibbs *
539225Sgibbs * This code is free software; you can redistribute it and/or modify it
639225Sgibbs * under the terms of the GNU General Public License version 2 only, as
739225Sgibbs * published by the Free Software Foundation.
839225Sgibbs *
939225Sgibbs * This code is distributed in the hope that it will be useful, but WITHOUT
1039225Sgibbs * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1139225Sgibbs * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1239225Sgibbs * version 2 for more details (a copy is included in the LICENSE file that
1339225Sgibbs * accompanied this code).
1439225Sgibbs *
1539225Sgibbs * You should have received a copy of the GNU General Public License version
1639225Sgibbs * 2 along with this work; if not, write to the Free Software Foundation,
1739225Sgibbs * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1839225Sgibbs *
1939225Sgibbs * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2039225Sgibbs * or visit www.oracle.com if you need additional information or have any
2139225Sgibbs * questions.
2239225Sgibbs */
2339225Sgibbs
2439225Sgibbs/**
2539225Sgibbs * NASHORN-40 : Member select expression without the select object expression (nothing before ".") crashes compiler with NPE.
2639225Sgibbs *
2739225Sgibbs * @test
2839225Sgibbs * @run
2939225Sgibbs */
3039225Sgibbs
3150477Spetertry {
3239225Sgibbs    eval("print(.foo)");
3339225Sgibbs} catch (e) {
3439225Sgibbs    print(e.toString().replace(/\\/g, '/'));
3539225Sgibbs}
3642887Simp
3739225Sgibbstry {
3839225Sgibbs    eval(".bar = 3423;");
3939225Sgibbs} catch (e) {
4051738Simp    print(e.toString().replace(/\\/g, '/'));
4151738Simp}
4251738Simp