bazel syntax: avoid StarlarkThread.getGlobals within lib.syntax

Another baby step to decoupling these classes: this change exposes a
Module parameter from various lib.syntax API functions instead of
using thread.getGlobals(), in most cases pushing the call into the
callers.

Construction of the thread and module is still entangled so we can't
do more yet.

Also:
- rename parseAndValidate{,Skylark} and
  replace thread by semantics parameter.
  Now ValidatorTest doesn't depend on Thread.

This is a breaking API change for copybara.

PiperOrigin-RevId: 294764678
diff --git a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java b/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java
index b9c9be4..3feba044 100644
--- a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java
@@ -55,6 +55,7 @@
 import com.google.devtools.build.lib.syntax.ParserInput;
 import com.google.devtools.build.lib.syntax.StarlarkFile;
 import com.google.devtools.build.lib.syntax.StarlarkList;
+import com.google.devtools.build.lib.syntax.StarlarkThread;
 import com.google.devtools.build.lib.syntax.SyntaxError;
 import com.google.devtools.build.lib.syntax.Tuple;
 import com.google.devtools.build.lib.testutil.MoreAsserts;
@@ -708,12 +709,13 @@
   // TODO(adonovan): rename execAndExport
   private void evalAndExport(String... lines) throws Exception {
     ParserInput input = ParserInput.fromLines(lines);
-    StarlarkFile file = EvalUtils.parseAndValidateSkylark(input, ev.getStarlarkThread());
+    StarlarkThread thread = ev.getStarlarkThread();
+    StarlarkFile file =
+        EvalUtils.parseAndValidate(input, thread.getGlobals(), thread.getSemantics());
     if (!file.ok()) {
       throw new SyntaxError(file.errors());
     }
-    SkylarkImportLookupFunction.execAndExport(
-        file, FAKE_LABEL, ev.getEventHandler(), ev.getStarlarkThread());
+    SkylarkImportLookupFunction.execAndExport(file, FAKE_LABEL, ev.getEventHandler(), thread);
   }
 
   @Test