Debian Codegraph @

src/com/google/javascript/jscomp/SourceAst.java

raw symbols SCIP
1 /*
2 * Copyright 2009 The Closure Compiler Authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package com.google.javascript.jscomp;
18
19 import com.google.javascript.rhino.InputId;
20 import com.google.javascript.rhino.Node;
21
22 import java.io.Serializable;
23
24 /**
25 * An interface for accessing the AST root of an input.
26 *
27 */
28 public interface SourceAst extends Serializable {
29 /**
30 * Gets the root node of the AST for the source file this represents. The AST
31 * is lazily instantiated and cached.
32 */
33 public Node getAstRoot(AbstractCompiler compiler);
34
35 /**
36 * Removes any references to root node of the AST. If it is requested again,
37 * another parse will be performed. This method is needed to allow the ASTs
38 * to be garbage collected if the inputs are still around after compilation.
39 */
40 public void clearAst();
41
42 /** @return The input id associated with this AST */
43 public InputId getInputId();
44
45 /** Returns the source file the generated AST represents. */
46 public SourceFile getSourceFile();
47
48 /**
49 * Sets the source file the generated AST represents. This can be called after
50 * deserializing if access to the source file is needed. If a different file
51 * is provided than that with which this was created, an IllegalStateException
52 * will be thrown.
53 */
54 public void setSourceFile(SourceFile file);
55 }