Remove wasteful function.toString() call in evalArgs. Also remove functions that were public because of skylark compilation.

PiperOrigin-RevId: 169739373
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/FuncallExpression.java b/src/main/java/com/google/devtools/build/lib/syntax/FuncallExpression.java
index f3019e4..a6d4597 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/FuncallExpression.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/FuncallExpression.java
@@ -514,10 +514,8 @@
 
   /**
    * Add one argument to the keyword map, registering a duplicate in case of conflict.
-   *
-   * <p>public for reflection by the compiler and calls from compiled functions
    */
-  public static void addKeywordArg(
+  private static void addKeywordArg(
       Map<String, Object> kwargs,
       String name,
       Object value,
@@ -529,10 +527,8 @@
 
   /**
    * Add multiple arguments to the keyword map (**kwargs), registering duplicates
-   *
-   * <p>public for reflection by the compiler and calls from compiled functions
    */
-  public static void addKeywordArgs(
+  private static void addKeywordArgs(
       Map<String, Object> kwargs,
       Object items,
       ImmutableList.Builder<String> duplicates,
@@ -556,11 +552,9 @@
   /**
    * Checks whether the given object is a {@link BaseFunction}.
    *
-   * <p>Public for reflection by the compiler and access from generated byte code.
-   *
    * @throws EvalException If not a BaseFunction.
    */
-  public static BaseFunction checkCallable(Object functionValue, Location location)
+  private static BaseFunction checkCallable(Object functionValue, Location location)
       throws EvalException {
     if (functionValue instanceof BaseFunction) {
       return (BaseFunction) functionValue;
@@ -572,11 +566,9 @@
 
   /**
    * Check the list from the builder and report an {@link EvalException} if not empty.
-   *
-   * <p>public for reflection by the compiler and calls from compiled functions
    */
-  public static void checkDuplicates(
-      ImmutableList.Builder<String> duplicates, String function, Location location)
+  private static void checkDuplicates(
+      ImmutableList.Builder<String> duplicates, Expression function, Location location)
       throws EvalException {
     List<String> dups = duplicates.build();
     if (!dups.isEmpty()) {
@@ -594,12 +586,10 @@
   /**
    * Call a method depending on the type of an object it is called on.
    *
-   * <p>Public for reflection by the compiler and access from generated byte code.
-   *
    * @param positionals The first object is expected to be the object the method is called on.
    * @param call the original expression that caused this call, needed for rules especially
    */
-  public Object invokeObjectMethod(
+  private Object invokeObjectMethod(
       String method,
       ImmutableList<Object> positionals,
       ImmutableMap<String, Object> keyWordArgs,
@@ -689,7 +679,7 @@
         addKeywordArg(kwargs, arg.getName(), value, duplicates);
       }
     }
-    checkDuplicates(duplicates, function.toString(), getLocation());
+    checkDuplicates(duplicates, function, getLocation());
   }
 
   @VisibleForTesting