Package com.google.javascript.jscomp
Class JsAst
java.lang.Object
com.google.javascript.jscomp.JsAst
- All Implemented Interfaces:
SourceAst
,Serializable
Generates an AST for a JavaScript source file.
- See Also:
-
Constructor Summary
-
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.
-
Constructor Details
-
JsAst
-
-
Method Details
-
getAstRoot
Description copied from interface:SourceAst
Gets the root node of the AST for the source file this represents. The AST is lazily instantiated and cached.- Specified by:
getAstRoot
in interfaceSourceAst
-
clearAst
public void clearAst()Description copied from interface:SourceAst
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
- Specified by:
getInputId
in interfaceSourceAst
- Returns:
- The input id associated with this AST
-
getSourceFile
Description copied from interface:SourceAst
Returns the source file the generated AST represents.- Specified by:
getSourceFile
in interfaceSourceAst
-
setSourceFile
Description copied from interface:SourceAst
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.- Specified by:
setSourceFile
in interfaceSourceAst
-