NASHORN-40.js revision 6:5a1b0714df0e
1280297Sjkim/*
2280297Sjkim * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
3280297Sjkim * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4238384Sjkim *
5238384Sjkim * This code is free software; you can redistribute it and/or modify it
6238384Sjkim * under the terms of the GNU General Public License version 2 only, as
7238384Sjkim * published by the Free Software Foundation.
8238384Sjkim *
9238384Sjkim * This code is distributed in the hope that it will be useful, but WITHOUT
10238384Sjkim * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11238384Sjkim * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12238384Sjkim * version 2 for more details (a copy is included in the LICENSE file that
13280297Sjkim * accompanied this code).
14238384Sjkim *
15238384Sjkim * You should have received a copy of the GNU General Public License version
16238384Sjkim * 2 along with this work; if not, write to the Free Software Foundation,
17238384Sjkim * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18238384Sjkim *
19238384Sjkim * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20238384Sjkim * or visit www.oracle.com if you need additional information or have any
21238384Sjkim * questions.
22238384Sjkim */
23238384Sjkim
24238384Sjkim/**
25238384Sjkim * NASHORN-40 : Member select expression without the select object expression (nothing before ".") crashes compiler with NPE.
26238384Sjkim *
27238384Sjkim * @test
28238384Sjkim * @run
29238384Sjkim */
30238384Sjkim
31238384Sjkimtry {
32238384Sjkim    eval("print(.foo)");
33238384Sjkim} catch (e) {
34238384Sjkim    print(e.toString().replace(/\\/g, '/'));
35238384Sjkim}
36238384Sjkim
37238384Sjkimtry {
38238384Sjkim    eval(".bar = 3423;");
39238384Sjkim} catch (e) {
40238384Sjkim    print(e.toString().replace(/\\/g, '/'));
41238384Sjkim}
42238384Sjkim