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

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

Issue 1407333006: Fix protocol for EXTRACT_LOCAL_VARIABLE and coveringExpressionOffsets/lengths. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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 e00506d72f45814cec60adeceef952c84fc8941f..c4df995ccff2df644b0e76bf0bab065a88b7df31 100644
--- a/pkg/analysis_server/tool/spec/generated/java/types/ExtractLocalVariableFeedback.java
+++ b/pkg/analysis_server/tool/spec/generated/java/types/ExtractLocalVariableFeedback.java
@@ -96,8 +96,8 @@ 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());
+ int[] coveringExpressionOffsets = jsonObject.get("coveringExpressionOffsets") == null ? null : JsonUtilities.decodeIntArray(jsonObject.get("coveringExpressionOffsets").getAsJsonArray());
+ int[] coveringExpressionLengths = jsonObject.get("coveringExpressionLengths") == null ? null : 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());
@@ -168,16 +168,20 @@ 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));
+ if (coveringExpressionOffsets != null) {
+ JsonArray jsonArrayCoveringExpressionOffsets = new JsonArray();
+ for (int elt : coveringExpressionOffsets) {
+ jsonArrayCoveringExpressionOffsets.add(new JsonPrimitive(elt));
+ }
+ jsonObject.add("coveringExpressionOffsets", jsonArrayCoveringExpressionOffsets);
}
- jsonObject.add("coveringExpressionOffsets", jsonArrayCoveringExpressionOffsets);
- JsonArray jsonArrayCoveringExpressionLengths = new JsonArray();
- for (int elt : coveringExpressionLengths) {
- jsonArrayCoveringExpressionLengths.add(new JsonPrimitive(elt));
+ if (coveringExpressionLengths != null) {
+ JsonArray jsonArrayCoveringExpressionLengths = new JsonArray();
+ for (int elt : coveringExpressionLengths) {
+ jsonArrayCoveringExpressionLengths.add(new JsonPrimitive(elt));
+ }
+ jsonObject.add("coveringExpressionLengths", jsonArrayCoveringExpressionLengths);
}
- jsonObject.add("coveringExpressionLengths", jsonArrayCoveringExpressionLengths);
JsonArray jsonArrayNames = new JsonArray();
for (String elt : names) {
jsonArrayNames.add(new JsonPrimitive(elt));
« no previous file with comments | « pkg/analysis_server/test/integration/protocol_matchers.dart ('k') | pkg/analysis_server/tool/spec/spec_input.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698