Class RewriteCallerCodeLocation

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

public final class RewriteCallerCodeLocation extends Object implements CompilerPass
Rewrites call-sites of functions that have goog.callerLocation as a default parameter.

E.g: function signal(val, here: goog.CodeLocation = goog.callerLocation()) {}

When a function is called without providing the optional `here` argument, we will rewrite the function call to include the code location.

i.e. `signal(0, goog.callerLocationIdInternalDoNotCallOrElse(path/to/file.ts:lineno:charno))`

  • Field Details

    • GOOG_CALLER_LOCATION_QUALIFIED_NAME

      public static final QualifiedName GOOG_CALLER_LOCATION_QUALIFIED_NAME
  • Constructor Details

    • RewriteCallerCodeLocation

      public RewriteCallerCodeLocation(AbstractCompiler compiler)
      Creates an instance.
  • 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