Class CompilerInput

  • All Implemented Interfaces:
    DependencyInfo

    public class CompilerInput
    extends DependencyInfo.Base
    A class for the internal representation of an input to the compiler. Wraps a SourceAst and maintain state such as module for the input and whether the input is an extern. Also calculates provided and required types.
    • Constructor Detail

      • CompilerInput

        public CompilerInput​(SourceAst ast)
      • CompilerInput

        public CompilerInput​(SourceAst ast,
                             boolean isExtern)
      • CompilerInput

        @Deprecated
        public CompilerInput​(SourceAst ast,
                             java.lang.String inputId,
                             boolean isExtern)
        Deprecated.
        the inputId is read from the SourceAst. Use CompilerInput(ast, isExtern)
      • CompilerInput

        @Deprecated
        public CompilerInput​(SourceAst ast,
                             InputId inputId,
                             boolean isExtern)
        Deprecated.
        the inputId is read from the SourceAst. Use CompilerInput(ast, isExtern)
      • CompilerInput

        public CompilerInput​(SourceFile file)
      • CompilerInput

        public CompilerInput​(SourceFile file,
                             boolean isExtern)
    • Method Detail

      • getInputId

        public InputId getInputId()
        Returns a name for this input. Must be unique across all inputs.
      • getName

        public java.lang.String getName()
        Returns a name for this input. Must be unique across all inputs.
      • getPathRelativeToClosureBase

        public java.lang.String getPathRelativeToClosureBase()
        Gets the path relative to closure-base, if one is available.
      • clearAst

        public void clearAst()
      • getSourceFile

        public SourceFile getSourceFile()
      • setCompiler

        public void setCompiler​(AbstractCompiler compiler)
        Sets an abstract compiler for doing parsing.
      • getRequires

        public com.google.common.collect.ImmutableList<DependencyInfo.Require> getRequires()
        Gets a list of types depended on by this input.
      • getTypeRequires

        public com.google.common.collect.ImmutableList<java.lang.String> getTypeRequires()
        Description copied from interface: DependencyInfo
        Gets the symbols type-required by this file (i.e. for typechecking only).
      • getProvides

        public com.google.common.collect.ImmutableList<java.lang.String> getProvides()
        Gets a list of types provided by this input.
      • getHasExternsAnnotation

        public boolean getHasExternsAnnotation()
        Description copied from interface: DependencyInfo
        Whether the file '@externs' annotation.
      • getHasNoCompileAnnotation

        public boolean getHasNoCompileAnnotation()
        Description copied from interface: DependencyInfo
        Whether the file has the '@nocompile' annotation.
      • addProvide

        public void addProvide​(java.lang.String provide)
        Registers a type that this input defines. Includes both explicitly declared namespaces via goog.provide and goog.module calls as well as implicit namespaces provided by module rewriting.
      • addOrderedRequire

        public boolean addOrderedRequire​(DependencyInfo.Require require)
        Registers a type that this input depends on in the order seen in the file.
      • getDynamicRequires

        public com.google.common.collect.ImmutableList<java.lang.String> getDynamicRequires()
        Returns the types that this input dynamically depends on in the order seen in the file. The returned types were loaded dynamically so while they are part of the dependency graph, they do not need sorted before this input.
      • addDynamicRequire

        public boolean addDynamicRequire​(java.lang.String require)
        Registers a type that this input depends on in the order seen in the file. The type was loaded dynamically so while it is part of the dependency graph, it does not need sorted before this input.
      • setHasFullParseDependencyInfo

        public void setHasFullParseDependencyInfo​(boolean hasFullParseDependencyInfo)
      • addRequire

        public void addRequire​(DependencyInfo.Require require)
        Registers a type that this input depends on.
      • getCode

        public java.lang.String getCode()
                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • getChunk

        public JSChunk getChunk()
        Returns the module to which the input belongs.
      • setModule

        public void setModule​(JSChunk module)
        Sets the module to which the input belongs.
      • isExtern

        public boolean isExtern()
      • getLineOffset

        public int getLineOffset​(int lineno)
      • getNumLines

        public int getNumLines()
        Returns:
        The number of lines in this input.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getLoadFlags

        public com.google.common.collect.ImmutableMap<java.lang.String,​java.lang.String> getLoadFlags()
        Description copied from interface: DependencyInfo
        Gets the loading information for this file.