code: private void tryEliminateOptionalArgs(ArrayList<Node> refs) {
      // Count the maximum number of arguments passed into this function all
      // all points of the program.
      int maxArgs = -1;
  
      for (Node n : refs) {
        if (ReferenceMap.isCallOrNewTarget(n)) {
          int numArgs = 0;
          Node firstArg = ReferenceMap.getFirstArgumentForCallOrNewOrDotCall(n);
          for (Node c = firstArg; c != null; c = c.getNext()) {
            numArgs++;
            if (c.isSpread()) {
              // Bail: with spread we must assume all parameters are used, don't waste
              // any more time.
              return;
            }
          }
  
          if (numArgs > maxArgs) {
            maxArgs = numArgs;
          }
        }
      }
  
      for (Node fn : ReferenceMap.getFunctionNodes(refs).values()) {
        eliminateParamsAfter(fn, maxArgs);
      }
    }
docs: Removes any optional parameters if no callers specifies it as an argument.