Class AbstractCompiler

    • Field Detail

      • annotationMap

        protected java.util.Map<java.lang.String,​java.lang.Object> annotationMap
    • Constructor Detail

      • AbstractCompiler

        public AbstractCompiler()
    • Method Detail

      • getScriptNode

        @Nullable
        public abstract Node getScriptNode​(java.lang.String filename)
      • addExportedNames

        public abstract void addExportedNames​(java.util.Set<java.lang.String> exportedVariableNames)
        Adds exported names to keep track.
      • getExportedNames

        public abstract java.util.Set<java.lang.String> getExportedNames()
        Gets the names that have been exported.
      • setVariableMap

        public abstract void setVariableMap​(VariableMap variableMap)
        Sets the variable renaming map
      • setPropertyMap

        public abstract void setPropertyMap​(VariableMap propertyMap)
        Sets the property renaming map
      • setStringMap

        public abstract void setStringMap​(VariableMap stringMap)
        Sets the string replacement map
      • setCssNames

        public abstract void setCssNames​(java.util.Map<java.lang.String,​java.lang.Integer> newCssNames)
        Sets the css names found during compilation.
      • setIdGeneratorMap

        public abstract void setIdGeneratorMap​(java.lang.String serializedIdMappings)
        Sets the id generator for cross-module motion.
      • getCrossModuleIdGenerator

        public abstract com.google.javascript.jscomp.IdGenerator getCrossModuleIdGenerator()
        Gets the id generator for cross-module motion.
      • setAnonymousFunctionNameMap

        public abstract void setAnonymousFunctionNameMap​(VariableMap functionMap)
        Sets the naming map for anonymous functions
      • getTypeRegistry

        public abstract JSTypeRegistry getTypeRegistry()
        Gets a central registry of type information from the compiled JS.
      • clearJSTypeRegistry

        public abstract void clearJSTypeRegistry()
      • getTopScope

        public abstract TypedScope getTopScope()
        Gets the top scope.
      • report

        public abstract void report​(JSError error)
        Report an error or warning.
      • getCodingConvention

        public abstract CodingConvention getCodingConvention()
        Gets the current coding convention.
      • reportChangeToEnclosingScope

        public abstract void reportChangeToEnclosingScope​(Node n)
        Passes that make modifications in a scope that is different than the Compiler.currentScope use this (eg, InlineVariables and many others)
      • reportChangeToChangeScope

        public abstract void reportChangeToChangeScope​(Node changeScopeRoot)
        Mark modifications in a scope that is different than the Compiler.currentScope use this (eg, InlineVariables and many others)
      • getTypeMismatches

        public abstract java.lang.Iterable<TypeMismatch> getTypeMismatches()
        Gets the central registry of type violations.
      • getImplicitInterfaceUses

        public abstract java.lang.Iterable<TypeMismatch> getImplicitInterfaceUses()
        Gets all types that are used implicitly as a matching interface type. These are recorded as TypeMismatchs only for convenience
      • toSource

        public abstract java.lang.String toSource()
        Prints a node to source code.
      • toSource

        public abstract java.lang.String toSource​(Node root)
        Prints a node to source code.
      • getReverseAbstractInterpreter

        public abstract ReverseAbstractInterpreter getReverseAbstractInterpreter()
        Get an interpreter for type analysis.
      • getErrorManager

        public abstract ErrorManager getErrorManager()
        Gets the error manager.
      • getRoot

        public abstract Node getRoot()
        Returns the root node of the AST, which includes both externs and source.
      • getProgress

        public abstract double getProgress()
        Returns:
        a number in [0,1] range indicating an approximate progress of the last compile. Note this should only be used as a hint and no assumptions should be made on accuracy, even a completed compile may choose not to set this to 1.0 at the end.
      • addInputSourceMap

        public abstract void addInputSourceMap​(java.lang.String name,
                                               SourceMapInput sourceMap)
        Adds a SourceMapInput for the given sourceFileName, to be used for error reporting and source map combining.
      • createAstFactory

        public com.google.javascript.jscomp.AstFactory createAstFactory()
        Returns a new AstFactory that will add type information to the nodes it creates if and only if type type checking has already happened.
      • getAstAnalyzer

        public AstAnalyzer getAstAnalyzer()
        Returns a new AstAnalyzer configured correctly to answer questions about Nodes in the AST currently being compiled.
      • setModuleMetadataMap

        public abstract void setModuleMetadataMap​(ModuleMetadataMap moduleMetadataMap)
      • getModuleMap

        public abstract ModuleMap getModuleMap()
      • setModuleMap

        public abstract void setModuleMap​(ModuleMap moduleMap)
      • createOrReopenLog

        @MustBeClosed
        public final LogFile createOrReopenLog​(java.lang.Class<?> owner,
                                               java.lang.String firstNamePart,
                                               java.lang.String... restNameParts)
        Provides logging access to a file with the specified name.
      • createOrReopenIndexedLog

        @MustBeClosed
        public final LogFile createOrReopenIndexedLog​(java.lang.Class<?> owner,
                                                      java.lang.String firstNamePart,
                                                      java.lang.String... restNameParts)
        Provides logging access to a file with the specified name, differentiated by the index of the current pass.

        Indexing helps in separating logs from different pass loops. The filename pattern is "[debug_log_directory]/[owner_name]/([name_part[i]]/){0,n-1}[pass_index]_[name_part[n]]".