Interface SourceAst

  • All Superinterfaces:
    java.io.Serializable
    All Known Implementing Classes:
    CompilerInput, JsAst, RecoverableJsAst, SyntheticAst

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

      • 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. This node is always non-null, even in the case of parse errors.
      • 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.