Interface SourceAst

All Superinterfaces:
Serializable
All Known Implementing Classes:
CompilerInput, JsAst, JsonMLAst, SyntheticAst

public interface SourceAst extends Serializable
An interface for accessing the AST root of an input.
  • Method Details

    • getAstRoot

      Node getAstRoot(AbstractCompiler compiler)
      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

      void setSourceFile(SourceFile file)
      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.