CompilationUnitTree.java revision 1590:1916a2c680d8
155714Skris/*
255714Skris * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
355714Skris * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
455714Skris *
555714Skris * This code is free software; you can redistribute it and/or modify it
655714Skris * under the terms of the GNU General Public License version 2 only, as
755714Skris * published by the Free Software Foundation.  Oracle designates this
8280304Sjkim * particular file as subject to the "Classpath" exception as provided
955714Skris * by Oracle in the LICENSE file that accompanied this code.
1055714Skris *
1155714Skris * This code is distributed in the hope that it will be useful, but WITHOUT
1255714Skris * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1355714Skris * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1455714Skris * version 2 for more details (a copy is included in the LICENSE file that
15280304Sjkim * accompanied this code).
1655714Skris *
1755714Skris * You should have received a copy of the GNU General Public License version
1855714Skris * 2 along with this work; if not, write to the Free Software Foundation,
1955714Skris * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2055714Skris *
2155714Skris * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22280304Sjkim * or visit www.oracle.com if you need additional information or have any
2355714Skris * questions.
2455714Skris */
2555714Skris
2655714Skrispackage jdk.nashorn.api.tree;
2755714Skris
2855714Skrisimport java.util.List;
2955714Skris
3055714Skris/**
3155714Skris * Represents the abstract syntax tree for compilation units (source
3255714Skris * files)
3355714Skris *
3455714Skris * @since 1.9
3555714Skris */
3655714Skrispublic interface CompilationUnitTree extends Tree {
37280304Sjkim    /**
3855714Skris     * Return the list of source elements in this compilation unit.
3955714Skris     *
40280304Sjkim     * @return the list of source elements in this compilation unit
4155714Skris     */
4255714Skris    List<? extends Tree> getSourceElements();
4355714Skris
4455714Skris    /**
4555714Skris     * Return the source name of this script compilation unit.
4655714Skris     *
4755714Skris     * @return the source name of this script compilation unit
4855714Skris     */
4955714Skris    String getSourceName();
5055714Skris
5155714Skris    /**
52280304Sjkim     * Returns if this is a ECMAScript "strict" compilation unit or not.
5355714Skris     *
5455714Skris     * @return true if this compilation unit is declared "strict"
5555714Skris     */
5655714Skris    boolean isStrict();
5755714Skris
58238405Sjkim    /**
59238405Sjkim     * Returns the line map for this compilation unit, if available.
60238405Sjkim     * Returns null if the line map is not available.
61238405Sjkim     *
62238405Sjkim     * @return the line map for this compilation unit
63238405Sjkim     */
64238405Sjkim    LineMap getLineMap();
65238405Sjkim}
66238405Sjkim