public class RecoverableJsAst extends java.lang.Object implements SourceAst
SourceAst that avoids re-creating the AST
unless it was manually cleared. This creates a single defensive copy of the
AST; however, it is not safe for multiple compilations to use this
simultaneously, as all compilations mutate this. Since this class copies
the tree, you instead should create a central RecoverableJsAst that does the
caching across compilations, and create new RecoverableJsAst's that act as
copying proxies around the original.| Constructor and Description |
|---|
RecoverableJsAst(SourceAst realSource,
boolean reportParseErrors)
Wraps around an existing SourceAst that provides caching between
compilations.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clearAst()
Removes any references to root node of the AST.
|
Node |
getAstRoot(AbstractCompiler compiler)
Gets the root node of the AST for the source file this represents.
|
InputId |
getInputId() |
SourceFile |
getSourceFile()
Returns the source file the generated AST represents.
|
void |
setSourceFile(SourceFile file)
Sets the source file the generated AST represents.
|
public RecoverableJsAst(SourceAst realSource, boolean reportParseErrors)
public Node getAstRoot(AbstractCompiler compiler)
SourceAstgetAstRoot in interface SourceAstpublic void clearAst()
SourceAstpublic InputId getInputId()
getInputId in interface SourceAstpublic SourceFile getSourceFile()
SourceAstgetSourceFile in interface SourceAstpublic void setSourceFile(SourceFile file)
SourceAstsetSourceFile in interface SourceAstCopyright © 2009-2020 Google. All Rights Reserved.