Class Compiler

All Implemented Interfaces:
CompilerInputProvider, ErrorHandler, SourceExcerptProvider, SourceFileMapping

public class Compiler extends AbstractCompiler implements ErrorHandler, SourceFileMapping
Compiler (and the other classes in this package) does the following:
  • parses JS code
  • checks for undefined variables
  • performs optimizations such as constant folding and constants inlining
  • renames variables (to short names)
  • outputs compact JavaScript code
External variables are declared in 'externs' files. For instance, the file may include definitions for global javascript/browser objects such as window, document.
  • Field Details

    • tracker

      public PerformanceTracker tracker
    • logger

      public static final Logger logger
      Logger for the whole com.google.javascript.jscomp domain - setting configuration for this logger affects all loggers in other classes within the compiler.
    • recentChange

      protected final com.google.javascript.jscomp.RecentChange recentChange
  • Constructor Details

    • Compiler

      public Compiler()
      Creates a Compiler that reports errors and warnings to its logger.
    • Compiler

      public Compiler(@Nullable PrintStream outStream)
      Creates a Compiler that reports errors and warnings to an output stream.
    • Compiler

      public Compiler(ErrorManager errorManager)
      Creates a Compiler that uses a custom error manager.
  • Method Details

    • setErrorManager

      public void setErrorManager(ErrorManager errorManager)
      Sets the error manager.
      Parameters:
      errorManager - the error manager, it cannot be null
    • initOptions

      public void initOptions(CompilerOptions options)
      Initializes the compiler options. It's called as part of a normal compile() job. Public for the callers that are not doing a normal compile() job.
    • printConfig

      public void printConfig()
    • reconcileOptionsWithGuards

      protected void reconcileOptionsWithGuards()
      When the CompilerOptions and its WarningsGuard overlap, reconcile any discrepancies.
    • initWithTypedAstFilesystem

      public final void initWithTypedAstFilesystem(List<SourceFile> externs, List<SourceFile> sources, CompilerOptions options, InputStream typedAstListStream)
      Initializes a compiler with deserialized state from the given TypedAst.List

      This method initializes all the state needed to run `.stage2Passes()` or do any similar sort of optimization work.

      Parameters:
      typedAstListStream - a gzipped, binary-serialized TypedAst.List proto
    • initChunksWithTypedAstFilesystem

      public void initChunksWithTypedAstFilesystem(List<SourceFile> externs, List<JSChunk> chunks, CompilerOptions options, InputStream typedAstListStream)
      Initializes a compiler with deserialized state from the given TypedAst.List

      This method initializes all the state needed to run `.stage2Passes()` or do any similar sort of optimization work.

      Parameters:
      typedAstListStream - a gzipped, binary-serialized TypedAst.List proto
    • initRuntimeLibraryTypedAsts

      public void initRuntimeLibraryTypedAsts(com.google.common.base.Optional<ColorPool.Builder> colorPoolBuilder)
      Description copied from class: AbstractCompiler
      Deserialize runtime libraries from a TypedAST packaged as a JAR resource and reconcile their Colors with the current inputs.

      This method must be called anywhere that Colors are reconciled for application to the AST. Otherwise Color information won't be consistent. `colorPoolBuilder` must be the same builder as used for the other inputs, and the caller retains ownership.

      Overrides:
      initRuntimeLibraryTypedAsts in class AbstractCompiler
      Parameters:
      colorPoolBuilder - if present, includes inferred optimization colors on the deserialized ASTs. If absent, does not include colors.
    • init

      public final void init(List<SourceFile> externs, List<SourceFile> sources, CompilerOptions options)
      Initializes the instance state needed for a compile job.
    • initChunks

      public void initChunks(List<SourceFile> externs, List<JSChunk> chunks, CompilerOptions options)
      Initializes the instance state needed for a compile job if the sources are in modules.
    • initBasedOnOptions

      public void initBasedOnOptions()
      Do any initialization that is dependent on the compiler options.
    • joinPathParts

      public static String joinPathParts(String... pathParts)
      Creates an OS specific path string from parts
    • rebuildInputsFromModules

      public void rebuildInputsFromModules()
    • compile

      public Result compile(SourceFile extern, SourceFile input, CompilerOptions options)
      Compiles a single source file and a single externs file.
    • compile

      public Result compile(List<SourceFile> externs, List<SourceFile> inputs, CompilerOptions options)
      Compiles a list of inputs.

      This is a convenience method to wrap up all the work of compilation, including generating the error and warning report.

      NOTE: All methods called here must be public, because client code must be able to replicate and customize this.

    • generateReport

      public void generateReport()
      Generates a report of all warnings and errors found during compilation to stderr.

      Client code must call this method explicitly if it doesn't use one of the convenience methods that do so automatically.

      Always call this method, even if the compiler throws an exception. The report will include information about the exception.

    • compileChunks

      public Result compileChunks(List<SourceFile> externs, List<JSChunk> chunks, CompilerOptions options)
      Compiles a list of chunks.

      This is a convenience method to wrap up all the work of compilation, including generating the error and warning report.

      NOTE: All methods called here must be public, because client code must be able to replicate and customize this.

    • stage1Passes

      public void stage1Passes()
      Perform compiler passes for stage 1 of compilation.

      Stage 1 consists primarily of error and type checking passes.

      parseForCompilation() must be called before this method is called.

      The caller is responsible for also calling generateReport() to generate a report of warnings and errors to stderr. See the invocation in compile(com.google.javascript.jscomp.SourceFile, com.google.javascript.jscomp.SourceFile, com.google.javascript.jscomp.CompilerOptions) for a good example.

    • stage2Passes

      public void stage2Passes(PassConfig.OptimizationPasses optimizationPasses)
      Perform compiler passes for stage 2 of compilation.

      Stage 2 consists primarily of transpilation and optimization passes.

      stage1Passes() must be called before this method is called.

      The caller is responsible for also calling generateReport() to generate a report of warnings and errors to stderr. See the invocation in compile(com.google.javascript.jscomp.SourceFile, com.google.javascript.jscomp.SourceFile, com.google.javascript.jscomp.CompilerOptions) for a good example.

    • stage3Passes

      public void stage3Passes()
      Perform compiler passes for stage 3 of compilation.

      Stage 3 consists primarily of localization passes.

      stage2Passes() must be called before this method is called.

      The caller is responsible for also calling generateReport() to generate a report of warnings and errors to stderr. See the invocation in compile(com.google.javascript.jscomp.SourceFile, com.google.javascript.jscomp.SourceFile, com.google.javascript.jscomp.CompilerOptions) for a good example.

    • disableThreads

      public void disableThreads()
      Disable threads. This is for clients that run on AppEngine and don't have threads.
    • setTimeout

      public void setTimeout(int timeout)
      Sets the timeout when Compiler is run in a thread
      Parameters:
      timeout - seconds to wait before timeout
    • runInCompilerThread

      public <T> T runInCompilerThread(Callable<T> callable)
      The primary purpose of this method is to run the provided code with a larger than standard stack.
    • performPostCompilationTasks

      public void performPostCompilationTasks()
      Performs all the bookkeeping required at the end of a compilation.

      This method must be called if the compilation makes it as far as doing checks.

      DON'T call it if the compiler threw an exception.

      DO call it even when hasErrors() returns true.

    • instrumentForCoverage

      public void instrumentForCoverage()
      Instrument code for coverage.

      parseForCompilation() must be called before this method is called.

      The caller is responsible for also calling generateReport() to generate a report of warnings and errors to stderr. See the invocation in compile(com.google.javascript.jscomp.SourceFile, com.google.javascript.jscomp.SourceFile, com.google.javascript.jscomp.CompilerOptions) for a good example.

      This method is mutually exclusive with stage1Passes() and stage2Passes(). Either call those two methods or this one, but not both.

    • parseForCompilation

      public void parseForCompilation()
      Parses input files in preparation for compilation.

      Either init() or initChunks() must be called first to set up the input files to be read.

      TODO(bradfordcsmith): Rename this to parse()

    • parse

      public void parse()
      Parses input files without doing progress tracking that is part of a full compile.

      Either init() or initChunks() must be called first to set up the input files to be read.

      TODO(bradfordcsmith): Rename this to parseIndependentOfCompilation() or similar.

    • parse

      public Node parse(SourceFile file)
    • createPassConfigInternal

      protected PassConfig createPassConfigInternal()
      Create the passes object. Clients should use setPassConfig instead of overriding this.
    • setPassConfig

      public void setPassConfig(PassConfig passes)
      Parameters:
      passes - The PassConfig to use with this Compiler.
      Throws:
      NullPointerException - if passes is null
      IllegalStateException - if this.passes has already been assigned
    • whitespaceOnlyPasses

      public void whitespaceOnlyPasses()
    • transpileAndDontCheck

      public void transpileAndDontCheck()
    • getScriptNode

      public final @Nullable Node getScriptNode(String filename)
      Specified by:
      getScriptNode in class AbstractCompiler
    • getResult

      public Result getResult()
      Returns the result of the compilation.
    • getErrors

      public com.google.common.collect.ImmutableList<JSError> getErrors()
      Returns the list of errors (never null).
    • getWarnings

      public com.google.common.collect.ImmutableList<JSError> getWarnings()
      Returns the list of warnings (never null).
    • getRoot

      public Node getRoot()
      Description copied from class: AbstractCompiler
      Returns the root node of the AST, which includes both externs and source.
      Specified by:
      getRoot in class AbstractCompiler
    • getAllowableFeatures

      public FeatureSet getAllowableFeatures()
    • getInput

      public @Nullable CompilerInput getInput(InputId id)
      Description copied from class: AbstractCompiler
      Looks up an input (possibly an externs input) by input id. May return null.
      Specified by:
      getInput in interface CompilerInputProvider
      Specified by:
      getInput in class AbstractCompiler
    • getChunks

      public @Nullable Iterable<JSChunk> getChunks()
      Gets the JS source modules in dependency order.

      Returns null if #init or #initChunks hasn't been called yet. Otherwise, the result is always non-empty, even in the degenerate case where there's only one module.

    • clearJSTypeRegistry

      public void clearJSTypeRegistry()
      Specified by:
      clearJSTypeRegistry in class AbstractCompiler
    • isTypeRegistryCleared

      public boolean isTypeRegistryCleared()
      Description copied from class: AbstractCompiler
      Returns `true` when type checking has run, but the type registry has been cleared.

      See also `clearJSTypeRegistry()`.

      Specified by:
      isTypeRegistryCleared in class AbstractCompiler
    • getTypeRegistry

      public JSTypeRegistry getTypeRegistry()
      Description copied from class: AbstractCompiler
      Gets a central registry of type information from the compiled JS.
      Specified by:
      getTypeRegistry in class AbstractCompiler
    • getColorRegistry

      public ColorRegistry getColorRegistry()
      Description copied from class: AbstractCompiler
      Gets a central registry of colors from deserialized JS types.
      Specified by:
      getColorRegistry in class AbstractCompiler
    • setColorRegistry

      public void setColorRegistry(ColorRegistry colorRegistry)
      Description copied from class: AbstractCompiler
      Sets the color registry
      Specified by:
      setColorRegistry in class AbstractCompiler
    • forwardDeclareType

      public void forwardDeclareType(String typeName)
    • hasTypeCheckingRun

      public boolean hasTypeCheckingRun()
      Description copied from class: AbstractCompiler
      Returns whether the typechecking passes have run
      Specified by:
      hasTypeCheckingRun in class AbstractCompiler
    • hasOptimizationColors

      public boolean hasOptimizationColors()
      Description copied from class: AbstractCompiler
      Whether the AST has been annotated with optimization colors.
      Specified by:
      hasOptimizationColors in class AbstractCompiler
    • getTypedScopeCreator

      public com.google.javascript.jscomp.ScopeCreator getTypedScopeCreator()
    • buildKnownSymbolTable

      public SymbolTable buildKnownSymbolTable()
    • getTopScope

      public @Nullable TypedScope getTopScope()
      Description copied from class: AbstractCompiler
      Gets the top scope.
      Specified by:
      getTopScope in class AbstractCompiler
    • getReverseAbstractInterpreter

      public ReverseAbstractInterpreter getReverseAbstractInterpreter()
      Description copied from class: AbstractCompiler
      Get an interpreter for type analysis.
      Specified by:
      getReverseAbstractInterpreter in class AbstractCompiler
    • getTypeMismatches

      public Iterable<TypeMismatch> getTypeMismatches()
      Description copied from class: AbstractCompiler
      Gets the central registry of type violations.
      Specified by:
      getTypeMismatches in class AbstractCompiler
    • maybeSetTracker

      public void maybeSetTracker()
    • newCompilerOptions

      protected CompilerOptions newCompilerOptions()
      Allow subclasses to override the default CompileOptions object.
    • parseSyntheticCode

      public Node parseSyntheticCode(String fileName, String js)
      Description copied from class: AbstractCompiler
      Parses code for injecting, and associate it with a given source file.
      Specified by:
      parseSyntheticCode in class AbstractCompiler
    • toSource

      public String toSource()
      Converts the main parse tree back to JS code.
      Specified by:
      toSource in class AbstractCompiler
    • toSource

      public String toSource(JSChunk chunk)
      Converts the parse tree for a chunk back to JS code.

      Consider using toSource(JSChunk, LicenseTracker) for better license handling. This call will emit all license text attached to all direct inputs to the chunk, which can be very inefficient.

    • toSource

      public String toSource(CodePrinter.LicenseTracker licenseTracker, JSChunk chunk)
      Converts the parse tree for a chunk back to JS code, using the given License Tracker to determine which licenses should be emitted before the source code.
      Parameters:
      licenseTracker - The license tracker implementation to use. Compiler.ChunkGraphAwareLicenseTracker is a suitable implementation when this method is being called on each chunk in the chunk graph in dependency order.
    • toSource

      public void toSource(Compiler.CodeBuilder cb, CodePrinter.LicenseTracker licenseTracker, int inputSeqNum, Node root)
      Writes out JS code from a root node. If printing input delimiters, this method will attach a comment to the start of the text indicating which input the output derived from. If there were any preserve annotations within the root's source, they will also be printed in a block comment at the beginning of the output.

      The LicenseTracker provided determines which licenses attached to the nodes visited should be included in the output. When building a single JS bundle, consider using the Compiler.SingleBinaryLicenseTracker implementation.

    • toSource

      public String toSource(Node n)
      Generates JavaScript source code for an AST, doesn't generate source map info.
      Specified by:
      toSource in class AbstractCompiler
    • getLicenseForFile

      public static @Nullable String getLicenseForFile(AbstractCompiler compiler, @Nullable String fileName)
    • toSourceArray

      public String[] toSourceArray(CodePrinter.LicenseTracker licenseTracker, JSChunk chunk)
      Converts the parse tree for each input in a module back to JS code, using the given License Tracker implementation to decide which licenses should be emitted before each input file.
      Parameters:
      licenseTracker - The license tracker implementation to use. Compiler.ChunkGraphAwareLicenseTracker is a suitable implementation when this method is being called on each module in the chunk graph in dependency order - see its javadoc on how to use it correctly.
      module - the chunk being converted to source.
    • getExternsRoot

      protected Node getExternsRoot()
    • getJsRoot

      protected Node getJsRoot()
    • getChangeStamp

      public int getChangeStamp()
    • incrementChangeStamp

      public void incrementChangeStamp()
    • reportChangeToChangeScope

      public void reportChangeToChangeScope(Node changeScopeRoot)
      Description copied from class: AbstractCompiler
      Mark modifications in a scope that is different than the Compiler.currentScope use this (eg, InlineVariables and many others)
      Specified by:
      reportChangeToChangeScope in class AbstractCompiler
    • reportFunctionDeleted

      public void reportFunctionDeleted(Node n)
    • reportDisambiguatePropertiesSummary

      public void reportDisambiguatePropertiesSummary(Supplier<String> summarySupplier)
      Description copied from class: AbstractCompiler
      Used by `DisambiguateProperties` to record a one-line summary of the work it accomplished, if any.

      This information will be included in the tracer mode output, if that is enabled.

      Specified by:
      reportDisambiguatePropertiesSummary in class AbstractCompiler
    • reportAmbiguatePropertiesSummary

      public void reportAmbiguatePropertiesSummary(Supplier<String> summarySupplier)
      Description copied from class: AbstractCompiler
      Used by `AmbiguateProperties` to record a one-line summary of the work it accomplished, if any.

      This information will be included in the tracer mode output, if that is enabled.

      Specified by:
      reportAmbiguatePropertiesSummary in class AbstractCompiler
    • reportChangeToEnclosingScope

      public void reportChangeToEnclosingScope(Node n)
      Description copied from class: AbstractCompiler
      Passes that make modifications in a scope that is different than the Compiler.currentScope use this (eg, InlineVariables and many others)
      Specified by:
      reportChangeToEnclosingScope in class AbstractCompiler
    • getCodingConvention

      public CodingConvention getCodingConvention()
      Description copied from class: AbstractCompiler
      Gets the current coding convention.
      Specified by:
      getCodingConvention in class AbstractCompiler
    • createConfig

      protected Config createConfig(Config.LanguageMode mode, Config.StrictMode strictMode)
    • getDiagnosticGroups

      public DiagnosticGroups getDiagnosticGroups()
      The warning classes that are available from the command-line, and are suppressible by the @suppress annotation.
    • report

      public void report(JSError error)
      Description copied from class: AbstractCompiler
      Report an error or warning.
      Specified by:
      report in class AbstractCompiler
    • report

      public void report(CheckLevel ignoredLevel, JSError error)
      Specified by:
      report in interface ErrorHandler
      Parameters:
      ignoredLevel - the reporting level
      error - the error to report
    • getErrorLevel

      public CheckLevel getErrorLevel(JSError error)
    • getErrorCount

      public int getErrorCount()
      Gets the number of errors.
    • getWarningCount

      public int getWarningCount()
      Gets the number of warnings.
    • hasErrors

      public boolean hasErrors()
      Consults the ErrorManager to see if we've encountered errors that should halt compilation.

      If CompilerOptions.canContinueAfterErrors() is true, this function always returns false without consulting the error manager. The error manager will continue to be told about new errors and warnings, but the compiler will complete compilation of all inputs.

    • getSourceFileContentByName

      public @Nullable CharSequence getSourceFileContentByName(String sourceName)
    • addInputSourceMap

      public void addInputSourceMap(String sourceFileName, SourceMapInput inputSourceMap)
      Description copied from class: AbstractCompiler
      Adds a SourceMapInput for the given sourceFileName, to be used for error reporting and source map combining.
      Specified by:
      addInputSourceMap in class AbstractCompiler
    • getBase64SourceMapContents

      public @Nullable String getBase64SourceMapContents(String sourceFileName)
      Returns the from a `//# sourceMappingURL=data:application/json;base64,` comment. This sourceMappingURL comment is a JS file's inline source map, embedded into the input JS file with a base64-encoded "data url" stored in `//# sourceMappingURL=` comment.
      Specified by:
      getBase64SourceMapContents in class AbstractCompiler
    • getSourceMapping

      public @Nullable com.google.debugging.sourcemap.proto.Mapping.OriginalMapping getSourceMapping(String sourceName, int lineNumber, int columnNumber)
      Description copied from interface: SourceFileMapping
      Returns the original mapping for the file name, line number and column position found in the source map. Returns null if none is found.
      Specified by:
      getSourceMapping in interface SourceExcerptProvider
      Specified by:
      getSourceMapping in interface SourceFileMapping
      Parameters:
      lineNumber - The line number, 1-based.
      columnNumber - The column index, 1-based.
    • getSourceLine

      public @Nullable String getSourceLine(String sourceName, int lineNumber)
      Description copied from interface: SourceExcerptProvider
      Get the line indicated by the line number. This call will return only the specific line.
      Specified by:
      getSourceLine in interface SourceExcerptProvider
      Parameters:
      lineNumber - the line number, 1 being the first line of the file
      Returns:
      the line indicated, or null if it does not exist
    • getSourceLines

      public @Nullable Region getSourceLines(String sourceName, int lineNumber, int length)
      Description copied from interface: SourceExcerptProvider
      Gets the specific lines returned by the beginning and excerpt length. Must not start or end with a carriage return. Implementations may decide to truncate lines but will always include the first line and never be longer than the specified length.
      Specified by:
      getSourceLines in interface SourceExcerptProvider
      Parameters:
      lineNumber - the line number, 1 being the first line of the file
      length - the desired length of the excerpt (in chars). If -1, returns just a single line. Otherwise, returns as many lines as needed. (including the remainder of the last line)
      Returns:
      the region around the line number indicated, or null if it does not exist
    • getSourceRegion

      public @Nullable Region getSourceRegion(String sourceName, int lineNumber)
      Description copied from interface: SourceExcerptProvider
      Get a region around the indicated line number. The exact definition of a region is implementation specific, but it must contain the line indicated by the line number. A region must not start or end by a carriage return.
      Specified by:
      getSourceRegion in interface SourceExcerptProvider
      Parameters:
      lineNumber - the line number, 1 being the first line of the file
      Returns:
      the region around the line number indicated, or null if it does not exist
    • getNodeForCodeInsertion

      protected Node getNodeForCodeInsertion(@Nullable JSChunk chunk)
    • getSourceMap

      public SourceMap getSourceMap()
    • setVariableMap

      public void setVariableMap(VariableMap variableMap)
      Description copied from class: AbstractCompiler
      Sets the variable renaming map
      Specified by:
      setVariableMap in class AbstractCompiler
    • setPropertyMap

      public void setPropertyMap(VariableMap propertyMap)
      Description copied from class: AbstractCompiler
      Sets the property renaming map
      Specified by:
      setPropertyMap in class AbstractCompiler
    • setStringMap

      public void setStringMap(VariableMap stringMap)
      Description copied from class: AbstractCompiler
      Sets the string replacement map
      Specified by:
      setStringMap in class AbstractCompiler
    • setCssNames

      public void setCssNames(Set<String> cssNames)
      Description copied from class: AbstractCompiler
      Sets the css names found during compilation.
      Specified by:
      setCssNames in class AbstractCompiler
    • setIdGeneratorMap

      public void setIdGeneratorMap(String serializedIdMappings)
      Description copied from class: AbstractCompiler
      Sets the id generator for cross-module motion.
      Specified by:
      setIdGeneratorMap in class AbstractCompiler
    • getTranspiledFiles

      public boolean getTranspiledFiles()
      Description copied from class: AbstractCompiler
      Gets whether any file needed to transpile any feature
      Specified by:
      getTranspiledFiles in class AbstractCompiler
    • setTranspiledFiles

      public void setTranspiledFiles(boolean transpiledFiles)
    • getCrossModuleIdGenerator

      public IdGenerator getCrossModuleIdGenerator()
      Description copied from class: AbstractCompiler
      Gets the id generator for cross-module motion.
      Specified by:
      getCrossModuleIdGenerator in class AbstractCompiler
    • setAnonymousFunctionNameMap

      public void setAnonymousFunctionNameMap(VariableMap functionMap)
      Description copied from class: AbstractCompiler
      Sets the naming map for anonymous functions
      Specified by:
      setAnonymousFunctionNameMap in class AbstractCompiler
    • setInstrumentationMapping

      public void setInstrumentationMapping(VariableMap instrumentationMapping)
      Description copied from class: AbstractCompiler
      Sets the mapping for instrumentation parameter encoding.
      Specified by:
      setInstrumentationMapping in class AbstractCompiler
    • getInstrumentationMapping

      public VariableMap getInstrumentationMapping()
    • addExportedNames

      public void addExportedNames(Set<String> exportedNames)
      Description copied from class: AbstractCompiler
      Adds exported names to keep track.
      Specified by:
      addExportedNames in class AbstractCompiler
    • getExportedNames

      public Set<String> getExportedNames()
      Description copied from class: AbstractCompiler
      Gets the names that have been exported.
      Specified by:
      getExportedNames in class AbstractCompiler
    • setDefineNames

      public void setDefineNames(Collection<String> defineNames)
      Description copied from class: AbstractCompiler
      Adds @define names to keep track.
      Specified by:
      setDefineNames in class AbstractCompiler
    • getDefineNames

      public com.google.common.collect.ImmutableSet<String> getDefineNames()
      Specified by:
      getDefineNames in class AbstractCompiler
    • getOptions

      public CompilerOptions getOptions()
    • setLoggingLevel

      public static void setLoggingLevel(Level level)
      Sets the logging level for the com.google.javascript.jscomp package.
    • getAstDotGraph

      public String getAstDotGraph() throws IOException
      Gets the DOT graph of the AST generated at the end of compilation.
      Throws:
      IOException
    • getErrorManager

      public ErrorManager getErrorManager()
      Description copied from class: AbstractCompiler
      Gets the error manager.
      Specified by:
      getErrorManager in class AbstractCompiler
    • getInputsById

      public Map<InputId,CompilerInput> getInputsById()
      Returns an unmodifiable view of the compiler inputs indexed by id.
    • getExternProperties

      public com.google.common.collect.ImmutableSet<String> getExternProperties()
      Description copied from class: AbstractCompiler
      Gets the names of the properties defined in externs or null if GatherExternProperties pass was not run yet.
      Specified by:
      getExternProperties in class AbstractCompiler
    • setAccessorSummary

      public void setAccessorSummary(com.google.javascript.jscomp.AccessorSummary summary)
      Description copied from class: AbstractCompiler
      Sets the summary of properties with getters and setters.
      Specified by:
      setAccessorSummary in class AbstractCompiler
    • ensureLibraryInjected

      protected Node ensureLibraryInjected(String resourceName, boolean force)
    • getComments

      public List<Comment> getComments(String filename)
    • getModuleLoader

      public ModuleLoader getModuleLoader()
    • initWebpackMap

      public void initWebpackMap(com.google.common.collect.ImmutableMap<String,String> inputPathByWebpackId)
    • createCompilerExecutor

      protected com.google.javascript.jscomp.CompilerExecutor createCompilerExecutor()
    • getCompilerExecutor

      protected com.google.javascript.jscomp.CompilerExecutor getCompilerExecutor()
    • restoreFromState

      protected void restoreFromState(Compiler.CompilerState compilerState)
      Restore the portions of the compiler state that don't require access to the serialized AST.
    • saveState

      public void saveState(OutputStream outputStream) throws IOException
      Throws:
      IOException
    • getCompilerState

      protected Compiler.CompilerState getCompilerState()
    • restoreState

      public void restoreState(InputStream inputStream) throws IOException, ClassNotFoundException
      Throws:
      IOException
      ClassNotFoundException
    • getModuleMetadataMap

      public ModuleMetadataMap getModuleMetadataMap()
      Specified by:
      getModuleMetadataMap in class AbstractCompiler
    • setModuleMetadataMap

      public void setModuleMetadataMap(ModuleMetadataMap moduleMetadataMap)
      Specified by:
      setModuleMetadataMap in class AbstractCompiler
    • getModuleMap

      public ModuleMap getModuleMap()
      Specified by:
      getModuleMap in class AbstractCompiler
    • setModuleMap

      public void setModuleMap(ModuleMap moduleMap)
      Specified by:
      setModuleMap in class AbstractCompiler
    • resetAndIntitializeSourceMap

      public void resetAndIntitializeSourceMap()