Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(294)

Unified Diff: pkg/analysis_server/tool/spec/generated/java/types/ExtractLocalVariableFeedback.java

Issue 1388783003: Spec change: include covering expressions into Extract Local protocol. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/tool/spec/generated/java/types/ExtractLocalVariableFeedback.java
diff --git a/pkg/analysis_server/tool/spec/generated/java/types/ExtractLocalVariableFeedback.java b/pkg/analysis_server/tool/spec/generated/java/types/ExtractLocalVariableFeedback.java
index c329329dbaa09c822f83ef3468d0070dfbdb6792..e00506d72f45814cec60adeceef952c84fc8941f 100644
--- a/pkg/analysis_server/tool/spec/generated/java/types/ExtractLocalVariableFeedback.java
+++ b/pkg/analysis_server/tool/spec/generated/java/types/ExtractLocalVariableFeedback.java
@@ -42,6 +42,18 @@ public class ExtractLocalVariableFeedback extends RefactoringFeedback {
public static final List<ExtractLocalVariableFeedback> EMPTY_LIST = Lists.newArrayList();
/**
+ * The offsets of the expressions that cover the specified selection, from the down most to the up
+ * most.
+ */
+ private final int[] coveringExpressionOffsets;
+
+ /**
+ * The lengths of the expressions that cover the specified selection, from the down most to the up
+ * most.
+ */
+ private final int[] coveringExpressionLengths;
+
+ /**
* The proposed names for the local variable.
*/
private final List<String> names;
@@ -61,7 +73,9 @@ public class ExtractLocalVariableFeedback extends RefactoringFeedback {
/**
* Constructor for {@link ExtractLocalVariableFeedback}.
*/
- public ExtractLocalVariableFeedback(List<String> names, int[] offsets, int[] lengths) {
+ public ExtractLocalVariableFeedback(int[] coveringExpressionOffsets, int[] coveringExpressionLengths, List<String> names, int[] offsets, int[] lengths) {
+ this.coveringExpressionOffsets = coveringExpressionOffsets;
+ this.coveringExpressionLengths = coveringExpressionLengths;
this.names = names;
this.offsets = offsets;
this.lengths = lengths;
@@ -72,6 +86,8 @@ public class ExtractLocalVariableFeedback extends RefactoringFeedback {
if (obj instanceof ExtractLocalVariableFeedback) {
ExtractLocalVariableFeedback other = (ExtractLocalVariableFeedback) obj;
return
+ Arrays.equals(other.coveringExpressionOffsets, coveringExpressionOffsets) &&
+ Arrays.equals(other.coveringExpressionLengths, coveringExpressionLengths) &&
ObjectUtilities.equals(other.names, names) &&
Arrays.equals(other.offsets, offsets) &&
Arrays.equals(other.lengths, lengths);
@@ -80,10 +96,12 @@ public class ExtractLocalVariableFeedback extends RefactoringFeedback {
}
public static ExtractLocalVariableFeedback fromJson(JsonObject jsonObject) {
+ int[] coveringExpressionOffsets = JsonUtilities.decodeIntArray(jsonObject.get("coveringExpressionOffsets").getAsJsonArray());
+ int[] coveringExpressionLengths = JsonUtilities.decodeIntArray(jsonObject.get("coveringExpressionLengths").getAsJsonArray());
List<String> names = JsonUtilities.decodeStringList(jsonObject.get("names").getAsJsonArray());
int[] offsets = JsonUtilities.decodeIntArray(jsonObject.get("offsets").getAsJsonArray());
int[] lengths = JsonUtilities.decodeIntArray(jsonObject.get("lengths").getAsJsonArray());
- return new ExtractLocalVariableFeedback(names, offsets, lengths);
+ return new ExtractLocalVariableFeedback(coveringExpressionOffsets, coveringExpressionLengths, names, offsets, lengths);
}
public static List<ExtractLocalVariableFeedback> fromJsonArray(JsonArray jsonArray) {
@@ -99,6 +117,22 @@ public class ExtractLocalVariableFeedback extends RefactoringFeedback {
}
/**
+ * The lengths of the expressions that cover the specified selection, from the down most to the up
+ * most.
+ */
+ public int[] getCoveringExpressionLengths() {
+ return coveringExpressionLengths;
+ }
+
+ /**
+ * The offsets of the expressions that cover the specified selection, from the down most to the up
+ * most.
+ */
+ public int[] getCoveringExpressionOffsets() {
+ return coveringExpressionOffsets;
+ }
+
+ /**
* The lengths of the expressions that would be replaced by a reference to the variable. The
* lengths correspond to the offsets. In other words, for a given expression, if the offset of that
* expression is offsets[i], then the length of that expression is lengths[i].
@@ -124,6 +158,8 @@ public class ExtractLocalVariableFeedback extends RefactoringFeedback {
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
+ builder.append(coveringExpressionOffsets);
+ builder.append(coveringExpressionLengths);
builder.append(names);
builder.append(offsets);
builder.append(lengths);
@@ -132,6 +168,16 @@ public class ExtractLocalVariableFeedback extends RefactoringFeedback {
public JsonObject toJson() {
JsonObject jsonObject = new JsonObject();
+ JsonArray jsonArrayCoveringExpressionOffsets = new JsonArray();
+ for (int elt : coveringExpressionOffsets) {
+ jsonArrayCoveringExpressionOffsets.add(new JsonPrimitive(elt));
+ }
+ jsonObject.add("coveringExpressionOffsets", jsonArrayCoveringExpressionOffsets);
+ JsonArray jsonArrayCoveringExpressionLengths = new JsonArray();
+ for (int elt : coveringExpressionLengths) {
+ jsonArrayCoveringExpressionLengths.add(new JsonPrimitive(elt));
+ }
+ jsonObject.add("coveringExpressionLengths", jsonArrayCoveringExpressionLengths);
JsonArray jsonArrayNames = new JsonArray();
for (String elt : names) {
jsonArrayNames.add(new JsonPrimitive(elt));
@@ -154,6 +200,10 @@ public class ExtractLocalVariableFeedback extends RefactoringFeedback {
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("[");
+ builder.append("coveringExpressionOffsets=");
+ builder.append(StringUtils.join(coveringExpressionOffsets, ", ") + ", ");
+ builder.append("coveringExpressionLengths=");
+ builder.append(StringUtils.join(coveringExpressionLengths, ", ") + ", ");
builder.append("names=");
builder.append(StringUtils.join(names, ", ") + ", ");
builder.append("offsets=");

Powered by Google App Engine
This is Rietveld 408576698