bazel: delete unused starlark.common.LocationRange
PiperOrigin-RevId: 317124823
diff --git a/src/tools/starlark/java/com/google/devtools/starlark/common/BUILD b/src/tools/starlark/java/com/google/devtools/starlark/common/BUILD
index 85a39ec..99feb4f 100644
--- a/src/tools/starlark/java/com/google/devtools/starlark/common/BUILD
+++ b/src/tools/starlark/java/com/google/devtools/starlark/common/BUILD
@@ -2,7 +2,7 @@
java_library(
name = "common",
- srcs = glob(["**/*.java"]),
+ srcs = ["DocstringUtils.java"],
visibility = [
# For docstring parsing libraries.
"//src/main/java/com/google/devtools/build/skydoc:__subpackages__",
@@ -10,8 +10,6 @@
"//src/tools/skylark/javatests/com/google/devtools/skylark/skylint:__subpackages__",
],
deps = [
- "//src/main/java/com/google/devtools/build/lib:syntax",
- "//src/main/java/com/google/devtools/build/lib/events",
"//src/main/java/net/starlark/java/annot",
"//third_party:guava",
],
diff --git a/src/tools/starlark/java/com/google/devtools/starlark/common/DocstringUtils.java b/src/tools/starlark/java/com/google/devtools/starlark/common/DocstringUtils.java
index 4e8ba7a..7a3cba0 100644
--- a/src/tools/starlark/java/com/google/devtools/starlark/common/DocstringUtils.java
+++ b/src/tools/starlark/java/com/google/devtools/starlark/common/DocstringUtils.java
@@ -17,7 +17,6 @@
import com.google.common.base.Preconditions;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableList;
-import com.google.devtools.starlark.common.LocationRange.Location;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -83,22 +82,18 @@
final String deprecated;
/** Rest of the docstring that is not part of any of the special sections above. */
final String longDescription;
- /** The texual location of the 'Arguments:' (not 'Args:') section in the function. */
- final LocationRange argumentsLocation;
public DocstringInfo(
String summary,
List<ParameterDoc> parameters,
String returns,
String deprecated,
- String longDescription,
- LocationRange argumentsLocation) {
+ String longDescription) {
this.summary = summary;
this.parameters = ImmutableList.copyOf(parameters);
this.returns = returns;
this.deprecated = deprecated;
this.longDescription = longDescription;
- this.argumentsLocation = argumentsLocation;
}
@@ -141,11 +136,6 @@
public String getReturns() {
return returns;
}
-
- /** Returns the texual location of the 'Arguments:' (not 'Args:') section in the function. */
- public LocationRange getArgumentsLocation() {
- return argumentsLocation;
- }
}
/**
@@ -339,8 +329,7 @@
String summary = line;
String nonStandardDeprecation = checkForNonStandardDeprecation(line);
if (!nextLine()) {
- return new DocstringInfo(
- summary, Collections.emptyList(), "", nonStandardDeprecation, "", null);
+ return new DocstringInfo(summary, Collections.emptyList(), "", nonStandardDeprecation, "");
}
if (!line.isEmpty()) {
error("the one-line summary should be followed by a blank line");
@@ -352,20 +341,12 @@
String returns = "";
String deprecated = "";
boolean descriptionBodyAfterSpecialSectionsReported = false;
- LocationRange argumentsLocation = null;
while (!eof()) {
switch (line) {
case "Args:":
parseArgumentSection(params, returns, deprecated);
break;
case "Arguments:":
- // Setting the location indicates an issue will be reported.
- argumentsLocation =
- new LocationRange(
- new Location(lineNumber, baselineIndentation + 1),
- // 10 is the length of "Arguments:".
- // The 1 is for the character after the base indentation.
- new Location(lineNumber, baselineIndentation + 1 + 10));
parseArgumentSection(params, returns, deprecated);
break;
case "Returns:":
@@ -404,12 +385,7 @@
deprecated = nonStandardDeprecation;
}
return new DocstringInfo(
- summary,
- params,
- returns,
- deprecated,
- String.join("\n", longDescriptionLines),
- argumentsLocation);
+ summary, params, returns, deprecated, String.join("\n", longDescriptionLines));
}
private void checkSectionStart(boolean duplicateSection) {
diff --git a/src/tools/starlark/java/com/google/devtools/starlark/common/LocationRange.java b/src/tools/starlark/java/com/google/devtools/starlark/common/LocationRange.java
deleted file mode 100644
index 68a315d..0000000
--- a/src/tools/starlark/java/com/google/devtools/starlark/common/LocationRange.java
+++ /dev/null
@@ -1,75 +0,0 @@
-// Copyright 2017 The Bazel Authors. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package com.google.devtools.starlark.common;
-
-import com.google.common.base.Preconditions;
-
-/**
- * Location range of a linter warning.
- *
- * <p>It is a closed interval: [start, end], i.e. the end location is the last character in the
- * range.
- */
-public class LocationRange {
- public final Location start;
- public final Location end;
-
- public LocationRange(Location start, Location end) {
- Preconditions.checkArgument(
- Location.compare(start, end) <= 0,
- "end location (%s) should be after start location (%s)",
- end,
- start);
- this.start = start;
- this.end = end;
- }
-
- public static int compare(LocationRange l1, LocationRange l2) {
- int cmp = Location.compare(l1.start, l2.start);
- if (cmp != 0) {
- return cmp;
- }
- return Location.compare(l1.end, l2.end);
- }
-
- @Override
- public String toString() {
- return start + "-" + end;
- }
-
- /** Single location in a file (line + column). */
- public static class Location {
- public final int line;
- public final int column;
-
- public Location(int line, int column) {
- this.line = line;
- this.column = column;
- }
-
- public static int compare(Location l1, Location l2) {
- int cmp = l1.line - l2.line;
- if (cmp != 0) {
- return cmp;
- }
- return l1.column - l2.column;
- }
-
- @Override
- public String toString() {
- return line + ":" + column;
- }
- }
-}