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

Unified Diff: pkg/analysis_server/lib/src/generated_protocol.dart

Issue 484313002: Make search.findElementReferences.result.element field optional. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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/lib/src/generated_protocol.dart
diff --git a/pkg/analysis_server/lib/src/generated_protocol.dart b/pkg/analysis_server/lib/src/generated_protocol.dart
index 23efa9d3870d04c944d5cb87f7685494b0c9e942..892a5d78d2853c253348cc647a368d8c5801ba6d 100644
--- a/pkg/analysis_server/lib/src/generated_protocol.dart
+++ b/pkg/analysis_server/lib/src/generated_protocol.dart
@@ -1829,7 +1829,7 @@ class SearchFindElementReferencesParams implements HasToJson {
*
* {
* "id": SearchId
- * "element": Element
+ * "element": optional Element
* }
*/
class SearchFindElementReferencesResult implements HasToJson {
@@ -1841,10 +1841,12 @@ class SearchFindElementReferencesResult implements HasToJson {
/**
* The element referenced or defined at the given offset and whose references
* will be returned in the search results.
+ *
+ * If no element was found at the given location, this field will be absent.
*/
final Element element;
- SearchFindElementReferencesResult(this.id, this.element);
+ SearchFindElementReferencesResult(this.id, {this.element});
factory SearchFindElementReferencesResult.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {
if (json is Map) {
@@ -1857,10 +1859,8 @@ class SearchFindElementReferencesResult implements HasToJson {
Element element;
if (json.containsKey("element")) {
element = new Element.fromJson(jsonDecoder, jsonPath + ".element", json["element"]);
- } else {
- throw jsonDecoder.missingKey(jsonPath, "element");
}
- return new SearchFindElementReferencesResult(id, element);
+ return new SearchFindElementReferencesResult(id, element: element);
} else {
throw jsonDecoder.mismatch(jsonPath, "search.findElementReferences result");
}
@@ -1874,7 +1874,9 @@ class SearchFindElementReferencesResult implements HasToJson {
Map<String, dynamic> toJson() {
Map<String, dynamic> result = {};
result["id"] = id;
- result["element"] = element.toJson();
+ if (element != null) {
+ result["element"] = element.toJson();
+ }
return result;
}
« no previous file with comments | « pkg/analysis_server/doc/api.html ('k') | pkg/analysis_server/test/integration/integration_test_methods.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698