Class InjectTranspilationRuntimeLibraries

java.lang.Object
com.google.javascript.jscomp.InjectTranspilationRuntimeLibraries
All Implemented Interfaces:
CompilerPass

public final class InjectTranspilationRuntimeLibraries extends Object implements CompilerPass
Injects JS library code that may be needed by the transpiled form of the input source code.

The intention here is to add anything that could be needed and rely on RemoveUnusedCode to remove the parts that don't end up getting used. This pass should run before type checking so the type checking code can add type information to the injected JavaScript for checking and optimization purposes.

TODO(b/120486392): consider merging this pass with InjectRuntimeLibraries and RewritePolyfills.

  • Constructor Details

    • InjectTranspilationRuntimeLibraries

      public InjectTranspilationRuntimeLibraries(AbstractCompiler compiler)
  • Method Details

    • process

      public void process(Node externs, Node root)
      Description copied from interface: CompilerPass
      Process the JS with root node root. Can modify the contents of each Node tree
      Specified by:
      process in interface CompilerPass
      Parameters:
      externs - Top of external JS tree
      root - Top of JS tree