SpreadTreeImpl.java revision 1739:4a6a1fd3d3dd
1295367Sdes/*
2261287Sdes * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
3261287Sdes * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4261287Sdes *
5261287Sdes * This code is free software; you can redistribute it and/or modify it
6261287Sdes * under the terms of the GNU General Public License version 2 only, as
7261287Sdes * published by the Free Software Foundation.  Oracle designates this
8261287Sdes * particular file as subject to the "Classpath" exception as provided
9261287Sdes * by Oracle in the LICENSE file that accompanied this code.
10261287Sdes *
11261287Sdes * This code is distributed in the hope that it will be useful, but WITHOUT
12261287Sdes * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13261287Sdes * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14261287Sdes * version 2 for more details (a copy is included in the LICENSE file that
15261287Sdes * accompanied this code).
16261287Sdes *
17261287Sdes * You should have received a copy of the GNU General Public License version
18261287Sdes * 2 along with this work; if not, write to the Free Software Foundation,
19261287Sdes * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20261287Sdes *
21261287Sdes * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22261287Sdes * or visit www.oracle.com if you need additional information or have any
23261287Sdes * questions.
24261287Sdes */
25261287Sdespackage jdk.nashorn.api.tree;
26261287Sdes
27261287Sdesimport jdk.nashorn.internal.ir.Expression;
28261287Sdes
29261287Sdesfinal class SpreadTreeImpl extends ExpressionTreeImpl
30261287Sdes        implements SpreadTree {
31261287Sdes
32261287Sdes    private final ExpressionTree expr;
33261287Sdes
34261287Sdes    SpreadTreeImpl(final Expression exprNode, final ExpressionTree expr) {
35261287Sdes        super(exprNode);
36261287Sdes        this.expr = expr;
37261287Sdes    }
38295367Sdes
39261287Sdes    @Override
40295367Sdes    public Tree.Kind getKind() {
41261287Sdes        return Tree.Kind.SPREAD;
42261287Sdes    }
43261287Sdes
44261287Sdes    @Override
45295367Sdes    public ExpressionTree getExpression() {
46261287Sdes        return expr;
47261287Sdes    }
48261287Sdes
49261287Sdes    @Override
50261287Sdes    public <R,D> R accept(final TreeVisitor<R,D> visitor, final D data) {
51261287Sdes        return visitor.visitSpread(this, data);
52261287Sdes    }
53261287Sdes}
54261287Sdes