Package com.google.javascript.jscomp
Interface SourceAst
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
CompilerInput
,JsAst
,JsonMLAst
,SyntheticAst
An interface for accessing the AST root of an input.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clearAst()
Removes any references to root node of the AST.getAstRoot
(AbstractCompiler compiler) Gets the root node of the AST for the source file this represents.Returns the source file the generated AST represents.void
setSourceFile
(SourceFile file) Sets the source file the generated AST represents.
-
Method Details
-
getAstRoot
Gets the root node of the AST for the source file this represents. The AST is lazily instantiated and cached. -
clearAst
void clearAst()Removes 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
InputId getInputId()- Returns:
- The input id associated with this AST
-
getSourceFile
SourceFile getSourceFile()Returns the source file the generated AST represents. -
setSourceFile
Sets 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.
-