Interface LinkerContext


public interface LinkerContext
Provides access to data about the linking process. Methods that return a SortedSet are guaranteed to have stable iteration order between runs of the compiler over identical input. Unless otherwise specified, the exact iteration order is left as an implementation detail.
  • Method Details

    • getConfigurationProperties

      SortedSet<ConfigurationProperty> getConfigurationProperties()
      Returns all configuration properties defined in the module. Configuration properties do not have any impact on deferred-binding decisions, but may affect the behaviors of Generators and Linkers.
    • getModuleFunctionName

      String getModuleFunctionName()
      Returns the name of the module's bootstrap function.
    • getModuleLastModified

      long getModuleLastModified()
      Returns the time at which the module being compiled was last modified. Can be used to set an appropriate timestamp on artifacts which depend solely on the module definition.
    • getModuleName

      String getModuleName()
      Returns the name of the module being compiled.
    • getProperties

      SortedSet<SelectionProperty> getProperties()
      Returns all deferred binding properties defined in the module. The SelectionProperties will be sorted by the standard string comparison function on the name of the property.
    • isOutputCompact

      boolean isOutputCompact()
      Returns true if the output should be as compact is possible and false if the output should be human-readable.
    • optimizeJavaScript

      String optimizeJavaScript(TreeLogger logger, String jsProgram) throws UnableToCompleteException
      Applies optimizations to a JavaScript program. This method is intended to be applied to bootstrap scripts in order to apply context-specific transformations to the program, based on the compiler's configuration. The return value will be functionally-equivalent JavaScript, although the exact transformations and structure of the output should be considered opaque. While this function can be safely applied multiple times, the best results will be obtained by performing all JavaScript assembly and calling the function just before writing the selection script to disk.
      Throws:
      UnableToCompleteException