bazel syntax: delete StarlarkFile.contentHashCode

It has moved to skyframe.ASTFileLookupValue.
Also, improve error messages related to ASTFileLookupValue.

PiperOrigin-RevId: 310543093
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/StarlarkFile.java b/src/main/java/com/google/devtools/build/lib/syntax/StarlarkFile.java
index 8fed417..e7858f8 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/StarlarkFile.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/StarlarkFile.java
@@ -14,7 +14,6 @@
 package com.google.devtools.build.lib.syntax;
 
 import com.google.common.collect.ImmutableList;
-import java.io.IOException;
 import java.util.Collections;
 import java.util.List;
 import javax.annotation.Nullable;
@@ -31,7 +30,6 @@
   private final FileOptions options;
   private final ImmutableList<Comment> comments;
   final List<SyntaxError> errors; // appended to by Resolver
-  @Nullable private final byte[] contentHashCode;
 
   // set by resolver
   @Nullable Resolver.Function resolved;
@@ -51,14 +49,12 @@
       ImmutableList<Statement> statements,
       FileOptions options,
       ImmutableList<Comment> comments,
-      List<SyntaxError> errors,
-      byte[] contentHashCode) {
+      List<SyntaxError> errors) {
     super(locs);
     this.statements = statements;
     this.options = options;
     this.comments = comments;
     this.errors = errors;
-    this.contentHashCode = contentHashCode;
   }
 
   // Creates a StarlarkFile from the given effective list of statements,
@@ -67,15 +63,9 @@
       FileLocations locs,
       ImmutableList<Statement> statements,
       FileOptions options,
-      Parser.ParseResult result,
-      byte[] contentHashCode) {
+      Parser.ParseResult result) {
     return new StarlarkFile(
-        locs,
-        statements,
-        options,
-        ImmutableList.copyOf(result.comments),
-        result.errors,
-        contentHashCode);
+        locs, statements, options, ImmutableList.copyOf(result.comments), result.errors);
   }
 
   /** Extract a subtree containing only statements from i (included) to j (excluded). */
@@ -85,8 +75,7 @@
         this.statements.subList(i, j),
         this.options,
         /*comments=*/ ImmutableList.of(),
-        errors,
-        /*contentHashCode=*/ null);
+        errors);
   }
   /**
    * Returns an unmodifiable view of the list of scanner, parser, and (perhaps) resolver errors
@@ -133,14 +122,7 @@
     stmts.addAll(prelude);
     stmts.addAll(result.statements);
 
-    return create(result.locs, stmts.build(), options, result, /*contentHashCode=*/ null);
-  }
-
-  // TODO(adonovan): move the digest into skyframe and delete this.
-  public static StarlarkFile parseWithDigest(ParserInput input, byte[] digest, FileOptions options)
-      throws IOException {
-    Parser.ParseResult result = Parser.parseFile(input, options);
-    return create(result.locs, ImmutableList.copyOf(result.statements), options, result, digest);
+    return create(result.locs, stmts.build(), options, result);
   }
 
   /**
@@ -159,12 +141,7 @@
    */
   public static StarlarkFile parse(ParserInput input, FileOptions options) {
     Parser.ParseResult result = Parser.parseFile(input, options);
-    return create(
-        result.locs,
-        ImmutableList.copyOf(result.statements),
-        options,
-        result,
-        /*contentHashCode=*/ null);
+    return create(result.locs, ImmutableList.copyOf(result.statements), options, result);
   }
 
   /** Parse a Starlark file with default options. */
@@ -176,13 +153,4 @@
   public FileOptions getOptions() {
     return options;
   }
-
-  /**
-   * Returns the digest of the source file, if this StarlarkFile was constructed by parseWithDigest,
-   * null otherwise.
-   */
-  @Nullable
-  public byte[] getContentHashCode() {
-    return contentHashCode;
-  }
 }