Class ConvertToTypedInterface

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

public class ConvertToTypedInterface extends Object implements CompilerPass
The goal of this pass is to shrink the AST, preserving only typing, not behavior.

To do this, it does things like removing function/method bodies, rvalues that are not needed, expressions that are not declarations, etc.

This is conceptually similar to the ijar tool[1] that bazel uses to shrink jars into minimal versions that can be used equivalently for compilation of downstream dependencies.

[1] https://github.com/bazelbuild/bazel/blob/master/third_party/ijar/README.txt

  • Constructor Details

    • ConvertToTypedInterface

      public ConvertToTypedInterface(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