bazel syntax: remove the 'thread' parameter where it's not needed.

RELNOTES: None.
PiperOrigin-RevId: 281055063
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/Dict.java b/src/main/java/com/google/devtools/build/lib/syntax/Dict.java
index b34f094..06083b6 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/Dict.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/Dict.java
@@ -548,7 +548,7 @@
       throws EvalException {
     Iterable<?> seq;
     try {
-      seq = EvalUtils.toIterable(args, loc, thread);
+      seq = EvalUtils.toIterable(args, loc);
     } catch (EvalException ex) {
       throw new EvalException(
           loc,
@@ -559,7 +559,7 @@
     for (Object item : seq) {
       Iterable<?> seq2;
       try {
-        seq2 = EvalUtils.toIterable(item, loc, null);
+        seq2 = EvalUtils.toIterable(item, loc);
       } catch (EvalException ex) {
         throw new EvalException(
             loc,
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/Eval.java b/src/main/java/com/google/devtools/build/lib/syntax/Eval.java
index dd14952..bffd0a7 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/Eval.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/Eval.java
@@ -96,7 +96,7 @@
 
   private TokenKind execFor(ForStatement node) throws EvalException, InterruptedException {
     Object o = eval(thread, node.getCollection());
-    Iterable<?> col = EvalUtils.toIterable(o, node.getLocation(), thread);
+    Iterable<?> col = EvalUtils.toIterable(o, node.getLocation());
     EvalUtils.lock(o, node.getLocation());
     try {
       for (Object it : col) {
@@ -301,7 +301,7 @@
   private static void assignList(
       ListExpression list, Object value, StarlarkThread thread, Location loc)
       throws EvalException, InterruptedException {
-    Collection<?> collection = EvalUtils.toCollection(value, loc, thread);
+    Collection<?> collection = EvalUtils.toCollection(value, loc);
     int len = list.getElements().size();
     if (len == 0) {
       throw new EvalException(
@@ -360,7 +360,7 @@
     // TODO(b/141263526): following Python, allow list+=iterable (but not list+iterable).
     if (op == TokenKind.PLUS && x instanceof StarlarkList && y instanceof StarlarkList) {
       StarlarkList<?> list = (StarlarkList) x;
-      list.extend(y, location, thread);
+      list.extend(y, location);
       return list;
     }
     return EvalUtils.binaryOp(op, x, y, thread, location);
@@ -642,7 +642,7 @@
 
             Object iterable = eval(thread, forClause.getIterable());
             Location loc = comp.getLocation();
-            Iterable<?> listValue = EvalUtils.toIterable(iterable, loc, thread);
+            Iterable<?> listValue = EvalUtils.toIterable(iterable, loc);
             EvalUtils.lock(iterable, loc);
             try {
               for (Object elem : listValue) {
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/EvalUtils.java b/src/main/java/com/google/devtools/build/lib/syntax/EvalUtils.java
index c3b8a94..a428f0b 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/EvalUtils.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/EvalUtils.java
@@ -301,8 +301,7 @@
     return obj;
   }
 
-  public static Collection<?> toCollection(Object o, Location loc, @Nullable StarlarkThread thread)
-      throws EvalException {
+  public static Collection<?> toCollection(Object o, Location loc) throws EvalException {
     if (o instanceof Collection) {
       return (Collection<?>) o;
     } else if (o instanceof Sequence) {
@@ -353,12 +352,11 @@
     }
   }
 
-  public static Iterable<?> toIterable(Object o, Location loc, @Nullable StarlarkThread thread)
-      throws EvalException {
+  public static Iterable<?> toIterable(Object o, Location loc) throws EvalException {
     if (o instanceof Iterable) {
       return (Iterable<?>) o;
     } else if (o instanceof Map) {
-      return toCollection(o, loc, thread);
+      return toCollection(o, loc);
     } else {
       throw new EvalException(loc,
           "type '" + getDataTypeName(o) + "' is not iterable");
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/MethodLibrary.java b/src/main/java/com/google/devtools/build/lib/syntax/MethodLibrary.java
index 9b8cbe9..e0b267d 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/MethodLibrary.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/MethodLibrary.java
@@ -62,11 +62,10 @@
               + "min([5, 6, 3]) == 3</pre>",
       extraPositionals =
           @Param(name = "args", type = Sequence.class, doc = "The elements to be checked."),
-      useLocation = true,
-      useStarlarkThread = true)
-  public Object min(Sequence<?> args, Location loc, StarlarkThread thread) throws EvalException {
+      useLocation = true)
+  public Object min(Sequence<?> args, Location loc) throws EvalException {
     try {
-      return findExtreme(args, EvalUtils.SKYLARK_COMPARATOR.reverse(), loc, thread);
+      return findExtreme(args, EvalUtils.SKYLARK_COMPARATOR.reverse(), loc);
     } catch (ComparisonException e) {
       throw new EvalException(loc, e);
     }
@@ -82,25 +81,22 @@
               + "max([5, 6, 3]) == 6</pre>",
       extraPositionals =
           @Param(name = "args", type = Sequence.class, doc = "The elements to be checked."),
-      useLocation = true,
-      useStarlarkThread = true)
-  public Object max(Sequence<?> args, Location loc, StarlarkThread thread) throws EvalException {
+      useLocation = true)
+  public Object max(Sequence<?> args, Location loc) throws EvalException {
     try {
-      return findExtreme(args, EvalUtils.SKYLARK_COMPARATOR, loc, thread);
+      return findExtreme(args, EvalUtils.SKYLARK_COMPARATOR, loc);
     } catch (ComparisonException e) {
       throw new EvalException(loc, e);
     }
   }
 
   /** Returns the maximum element from this list, as determined by maxOrdering. */
-  private static Object findExtreme(
-      Sequence<?> args, Ordering<Object> maxOrdering, Location loc, StarlarkThread thread)
+  private static Object findExtreme(Sequence<?> args, Ordering<Object> maxOrdering, Location loc)
       throws EvalException {
     // Args can either be a list of items to compare, or a singleton list whose element is an
     // iterable of items to compare. In either case, there must be at least one item to compare.
     try {
-      Iterable<?> items =
-          (args.size() == 1) ? EvalUtils.toIterable(args.get(0), loc, thread) : args;
+      Iterable<?> items = (args.size() == 1) ? EvalUtils.toIterable(args.get(0), loc) : args;
       return maxOrdering.max(items);
     } catch (NoSuchElementException ex) {
       throw new EvalException(loc, "expected at least one item", ex);
@@ -123,10 +119,9 @@
             // TODO(cparsons): This parameter should be positional-only.
             legacyNamed = true)
       },
-      useLocation = true,
-      useStarlarkThread = true)
-  public Boolean all(Object collection, Location loc, StarlarkThread thread) throws EvalException {
-    return !hasElementWithBooleanValue(collection, false, loc, thread);
+      useLocation = true)
+  public Boolean all(Object collection, Location loc) throws EvalException {
+    return !hasElementWithBooleanValue(collection, false, loc);
   }
 
   @SkylarkCallable(
@@ -145,15 +140,14 @@
             // TODO(cparsons): This parameter should be positional-only.
             legacyNamed = true)
       },
-      useLocation = true,
-      useStarlarkThread = true)
-  public Boolean any(Object collection, Location loc, StarlarkThread thread) throws EvalException {
-    return hasElementWithBooleanValue(collection, true, loc, thread);
+      useLocation = true)
+  public Boolean any(Object collection, Location loc) throws EvalException {
+    return hasElementWithBooleanValue(collection, true, loc);
   }
 
-  private static boolean hasElementWithBooleanValue(
-      Object collection, boolean value, Location loc, StarlarkThread thread) throws EvalException {
-    Iterable<?> iterable = EvalUtils.toIterable(collection, loc, thread);
+  private static boolean hasElementWithBooleanValue(Object collection, boolean value, Location loc)
+      throws EvalException {
+    Iterable<?> iterable = EvalUtils.toIterable(collection, loc);
     for (Object obj : iterable) {
       if (Starlark.truth(obj) == value) {
         return true;
@@ -201,7 +195,7 @@
       final StarlarkThread thread)
       throws EvalException, InterruptedException {
 
-    Object[] array = EvalUtils.toCollection(iterable, loc, thread).toArray();
+    Object[] array = EvalUtils.toCollection(iterable, loc).toArray();
     if (key == Starlark.NONE) {
       try {
         Arrays.sort(array, EvalUtils.SKYLARK_COMPARATOR);
@@ -281,7 +275,7 @@
       throw new EvalException(loc, "Argument to reversed() must be a sequence, not a dictionary.");
     }
     ArrayDeque<Object> tmpList = new ArrayDeque<>();
-    for (Object element : EvalUtils.toIterable(sequence, loc, thread)) {
+    for (Object element : EvalUtils.toIterable(sequence, loc)) {
       tmpList.addFirst(element);
     }
     return StarlarkList.copyOf(thread.mutability(), tmpList);
@@ -302,10 +296,9 @@
             // TODO(cparsons): This parameter should be positional-only.
             legacyNamed = true)
       },
-      useLocation = true,
-      useStarlarkThread = true)
-  public Tuple<?> tuple(Object x, Location loc, StarlarkThread thread) throws EvalException {
-    return Tuple.copyOf(EvalUtils.toCollection(x, loc, thread));
+      useLocation = true)
+  public Tuple<?> tuple(Object x, Location loc) throws EvalException {
+    return Tuple.copyOf(EvalUtils.toCollection(x, loc));
   }
 
   @SkylarkCallable(
@@ -326,7 +319,7 @@
       useLocation = true,
       useStarlarkThread = true)
   public StarlarkList<?> list(Object x, Location loc, StarlarkThread thread) throws EvalException {
-    return StarlarkList.copyOf(thread.mutability(), EvalUtils.toCollection(x, loc, thread));
+    return StarlarkList.copyOf(thread.mutability(), EvalUtils.toCollection(x, loc));
   }
 
   @SkylarkCallable(
@@ -629,7 +622,7 @@
       useLocation = true)
   public StarlarkList<?> enumerate(Object input, Integer start, Location loc, StarlarkThread thread)
       throws EvalException {
-    Collection<?> src = EvalUtils.toCollection(input, loc, thread);
+    Collection<?> src = EvalUtils.toCollection(input, loc);
     Object[] array = new Object[src.size()];
     int i = 0;
     for (Object x : src) {
@@ -1183,7 +1176,7 @@
       throws EvalException {
     Iterator<?>[] iterators = new Iterator<?>[args.size()];
     for (int i = 0; i < args.size(); i++) {
-      iterators[i] = EvalUtils.toIterable(args.get(i), loc, thread).iterator();
+      iterators[i] = EvalUtils.toIterable(args.get(i), loc).iterator();
     }
     ArrayList<Tuple<?>> result = new ArrayList<>();
     boolean allHasNext;
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/StarlarkList.java b/src/main/java/com/google/devtools/build/lib/syntax/StarlarkList.java
index dbcf763..d97d1a0 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/StarlarkList.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/StarlarkList.java
@@ -403,12 +403,10 @@
       name = "extend",
       doc = "Adds all items to the end of the list.",
       parameters = {@Param(name = "items", type = Object.class, doc = "Items to add at the end.")},
-      useLocation = true,
-      useStarlarkThread = true)
-  public NoneType extend(Object items, Location loc, StarlarkThread thread) throws EvalException {
+      useLocation = true)
+  public NoneType extend(Object items, Location loc) throws EvalException {
     @SuppressWarnings("unchecked")
-    Collection<? extends E> src =
-        (Collection<? extends E>) EvalUtils.toCollection(items, loc, thread);
+    Collection<? extends E> src = (Collection<? extends E>) EvalUtils.toCollection(items, loc);
     addAll(src, loc);
     return Starlark.NONE;
   }
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/StringModule.java b/src/main/java/com/google/devtools/build/lib/syntax/StringModule.java
index fc190dd..da8be49 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/StringModule.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/StringModule.java
@@ -113,7 +113,7 @@
       useStarlarkThread = true)
   public String join(String self, Object elements, Location loc, StarlarkThread thread)
       throws EvalException {
-    Collection<?> items = EvalUtils.toCollection(elements, loc, thread);
+    Collection<?> items = EvalUtils.toCollection(elements, loc);
     if (thread.getSemantics().incompatibleStringJoinRequiresStrings()) {
       for (Object item : items) {
         if (!(item instanceof String)) {