public class RecoverableJsAst extends 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)
SourceAst
getAstRoot
in interface SourceAst
public void clearAst()
SourceAst
public InputId getInputId()
getInputId
in interface SourceAst
public SourceFile getSourceFile()
SourceAst
getSourceFile
in interface SourceAst
public void setSourceFile(SourceFile file)
SourceAst
setSourceFile
in interface SourceAst
Copyright © 2009-2017 Google. All Rights Reserved.