arrow.js revision 1739:4a6a1fd3d3dd
1290001Sglebius/*
2290001Sglebius * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
3290001Sglebius * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4290001Sglebius *
5290001Sglebius * This code is free software; you can redistribute it and/or modify it
6290001Sglebius * under the terms of the GNU General Public License version 2 only, as
7290001Sglebius * published by the Free Software Foundation.
8290001Sglebius *
9290001Sglebius * This code is distributed in the hope that it will be useful, but WITHOUT
10290001Sglebius * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11290001Sglebius * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12290001Sglebius * version 2 for more details (a copy is included in the LICENSE file that
13290001Sglebius * accompanied this code).
14290001Sglebius *
15290001Sglebius * You should have received a copy of the GNU General Public License version
16290001Sglebius * 2 along with this work; if not, write to the Free Software Foundation,
17290001Sglebius * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18290001Sglebius *
19290001Sglebius * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20290001Sglebius * or visit www.oracle.com if you need additional information or have any
21290001Sglebius * questions.
22290001Sglebius */
23290001Sglebius
24290001Sglebius/**
25290001Sglebius * Tests to check representation of ES6 arrows.
26290001Sglebius *
27290001Sglebius * @test
28290001Sglebius * @option -scripting
29290001Sglebius * @run
30290001Sglebius */
31290001Sglebius
32290001Sglebiusload(__DIR__ + "utils.js")
33290001Sglebius
34290001Sglebiusvar code = <<EOF
35290001Sglebius
36290001Sglebiusvar f = x=>x*2;
37290001Sglebius[].map(v => v + 1);
38290001Sglebius
39290001SglebiusEOF
40290001Sglebius
41290001Sglebiusparse("arrow.js", code, "--language=es6", new (Java.extend(visitor_es6, {
42290001Sglebius    visitVariable : function (node, obj) {
43290001Sglebius        obj.push(convert(node))
44290001Sglebius    },
45290001Sglebius    visitExpressionStatement : function (node, obj) {
46290001Sglebius        obj.push(convert(node))
47290001Sglebius    }
48290001Sglebius})))
49290001Sglebius
50290001Sglebius