Package com.google.javascript.jscomp
Class JsAst
- java.lang.Object
-
- com.google.javascript.jscomp.JsAst
-
- All Implemented Interfaces:
SourceAst,java.io.Serializable
public class JsAst extends java.lang.Object implements SourceAst
Generates an AST for a JavaScript source file.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classJsAst.ParseResultSimple class to share parse results between compilation jobsstatic classJsAst.RhinoErrorRepresentation of Rhino parser error.
-
Constructor Summary
Constructors Constructor Description JsAst(SourceFile sourceFile)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearAst()Removes any references to root node of the AST.NodegetAstRoot(AbstractCompiler compiler)Gets the root node of the AST for the source file this represents.FeatureSetgetFeatures(AbstractCompiler compiler)InputIdgetInputId()SourceFilegetSourceFile()Returns the source file the generated AST represents.voidsetSourceFile(SourceFile file)Sets the source file the generated AST represents.
-
-
-
Constructor Detail
-
JsAst
public JsAst(SourceFile sourceFile)
-
-
Method Detail
-
getAstRoot
public Node getAstRoot(AbstractCompiler compiler)
Description copied from interface:SourceAstGets the root node of the AST for the source file this represents. The AST is lazily instantiated and cached. This node is always non-null, even in the case of parse errors.- Specified by:
getAstRootin interfaceSourceAst
-
clearAst
public void clearAst()
Description copied from interface:SourceAstRemoves any references to root node of the AST. If it is requested again, another parse will be performed. This method is needed to allow the ASTs to be garbage collected if the inputs are still around after compilation.
-
getInputId
public InputId getInputId()
- Specified by:
getInputIdin interfaceSourceAst- Returns:
- The input id associated with this AST
-
getSourceFile
public SourceFile getSourceFile()
Description copied from interface:SourceAstReturns the source file the generated AST represents.- Specified by:
getSourceFilein interfaceSourceAst
-
setSourceFile
public void setSourceFile(SourceFile file)
Description copied from interface:SourceAstSets the source file the generated AST represents. This can be called after deserializing if access to the source file is needed. If a different file is provided than that with which this was created, an IllegalStateException will be thrown.- Specified by:
setSourceFilein interfaceSourceAst
-
getFeatures
public FeatureSet getFeatures(AbstractCompiler compiler)
-
-