ArrayLiteralTreeImpl.java revision 1204:9597425b6b38
1168404Spjd/*
2168404Spjd * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
3168404Spjd * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4168404Spjd *
5168404Spjd * This code is free software; you can redistribute it and/or modify it
6168404Spjd * under the terms of the GNU General Public License version 2 only, as
7168404Spjd * published by the Free Software Foundation.  Oracle designates this
8168404Spjd * particular file as subject to the "Classpath" exception as provided
9168404Spjd * by Oracle in the LICENSE file that accompanied this code.
10168404Spjd *
11168404Spjd * This code is distributed in the hope that it will be useful, but WITHOUT
12168404Spjd * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13168404Spjd * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14168404Spjd * version 2 for more details (a copy is included in the LICENSE file that
15168404Spjd * accompanied this code).
16168404Spjd *
17168404Spjd * You should have received a copy of the GNU General Public License version
18168404Spjd * 2 along with this work; if not, write to the Free Software Foundation,
19168404Spjd * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20168404Spjd *
21168404Spjd * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22219089Spjd * or visit www.oracle.com if you need additional information or have any
23249195Smm * questions.
24168404Spjd */
25168404Spjd
26168404Spjdpackage jdk.nashorn.api.tree;
27168404Spjd
28168404Spjdimport java.util.List;
29168404Spjdimport jdk.nashorn.internal.ir.LiteralNode;
30168404Spjd
31168404Spjdfinal class ArrayLiteralTreeImpl extends ExpressionTreeImpl
32168404Spjd    implements ArrayLiteralTree {
33168404Spjd    private final List<? extends ExpressionTree> elements;
34168404Spjd    ArrayLiteralTreeImpl(final LiteralNode<?> node, final List<? extends ExpressionTree> elements) {
35168404Spjd        super(node);
36219089Spjd        this.elements = elements;
37219089Spjd    }
38208047Smm
39168404Spjd    @Override
40219089Spjd    public Tree.Kind getKind() {
41168404Spjd        return Tree.Kind.ARRAY_LITERAL;
42219089Spjd    }
43208047Smm
44208047Smm    @Override
45208047Smm    public List<? extends ExpressionTree> getElements() {
46208047Smm        return elements;
47208047Smm    }
48208047Smm
49208047Smm    @Override
50219089Spjd    public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
51168404Spjd        return visitor.visitArrayLiteral(this, data);
52219089Spjd    }
53208047Smm}
54208047Smm