| 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 fe6f6e0441694bfdeaca96688b52711f3fd68bbc..552081fbb3cb500d8512417176e1c1c839b1f232 100644
|
| --- a/pkg/analysis_server/lib/src/generated_protocol.dart
|
| +++ b/pkg/analysis_server/lib/src/generated_protocol.dart
|
| @@ -78,7 +78,7 @@ class ServerGetVersionResult implements HasToJson {
|
| * server.setSubscriptions params
|
| *
|
| * {
|
| - * "subscriptions": List<ServerService>
|
| + * "subscriptions": optional List<ServerService>
|
| * }
|
| */
|
| class ServerSetSubscriptionsParams implements HasToJson {
|
| @@ -87,7 +87,11 @@ class ServerSetSubscriptionsParams implements HasToJson {
|
| */
|
| List<ServerService> subscriptions;
|
|
|
| - ServerSetSubscriptionsParams(this.subscriptions);
|
| + ServerSetSubscriptionsParams({this.subscriptions}) {
|
| + if (subscriptions == null) {
|
| + subscriptions = <ServerService>[];
|
| + }
|
| + }
|
|
|
| factory ServerSetSubscriptionsParams.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {
|
| if (json == null) {
|
| @@ -98,9 +102,9 @@ class ServerSetSubscriptionsParams implements HasToJson {
|
| if (json.containsKey("subscriptions")) {
|
| subscriptions = jsonDecoder._decodeList(jsonPath + ".subscriptions", json["subscriptions"], (String jsonPath, Object json) => new ServerService.fromJson(jsonDecoder, jsonPath, json));
|
| } else {
|
| - throw jsonDecoder.missingKey(jsonPath, "subscriptions");
|
| + subscriptions = <ServerService>[];
|
| }
|
| - return new ServerSetSubscriptionsParams(subscriptions);
|
| + return new ServerSetSubscriptionsParams(subscriptions: subscriptions);
|
| } else {
|
| throw jsonDecoder.mismatch(jsonPath, "server.setSubscriptions params");
|
| }
|
| @@ -113,7 +117,9 @@ class ServerSetSubscriptionsParams implements HasToJson {
|
|
|
| Map<String, dynamic> toJson() {
|
| Map<String, dynamic> result = {};
|
| - result["subscriptions"] = subscriptions.map((ServerService value) => value.toJson()).toList();
|
| + if (subscriptions.isNotEmpty) {
|
| + result["subscriptions"] = subscriptions.map((ServerService value) => value.toJson()).toList();
|
| + }
|
| return result;
|
| }
|
|
|
| @@ -367,7 +373,7 @@ class AnalysisGetErrorsParams implements HasToJson {
|
| * analysis.getErrors result
|
| *
|
| * {
|
| - * "errors": List<AnalysisError>
|
| + * "errors": optional List<AnalysisError>
|
| * }
|
| */
|
| class AnalysisGetErrorsResult implements HasToJson {
|
| @@ -376,7 +382,11 @@ class AnalysisGetErrorsResult implements HasToJson {
|
| */
|
| List<AnalysisError> errors;
|
|
|
| - AnalysisGetErrorsResult(this.errors);
|
| + AnalysisGetErrorsResult({this.errors}) {
|
| + if (errors == null) {
|
| + errors = <AnalysisError>[];
|
| + }
|
| + }
|
|
|
| factory AnalysisGetErrorsResult.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {
|
| if (json == null) {
|
| @@ -387,9 +397,9 @@ class AnalysisGetErrorsResult implements HasToJson {
|
| if (json.containsKey("errors")) {
|
| errors = jsonDecoder._decodeList(jsonPath + ".errors", json["errors"], (String jsonPath, Object json) => new AnalysisError.fromJson(jsonDecoder, jsonPath, json));
|
| } else {
|
| - throw jsonDecoder.missingKey(jsonPath, "errors");
|
| + errors = <AnalysisError>[];
|
| }
|
| - return new AnalysisGetErrorsResult(errors);
|
| + return new AnalysisGetErrorsResult(errors: errors);
|
| } else {
|
| throw jsonDecoder.mismatch(jsonPath, "analysis.getErrors result");
|
| }
|
| @@ -402,7 +412,9 @@ class AnalysisGetErrorsResult implements HasToJson {
|
|
|
| Map<String, dynamic> toJson() {
|
| Map<String, dynamic> result = {};
|
| - result["errors"] = errors.map((AnalysisError value) => value.toJson()).toList();
|
| + if (errors.isNotEmpty) {
|
| + result["errors"] = errors.map((AnalysisError value) => value.toJson()).toList();
|
| + }
|
| return result;
|
| }
|
|
|
| @@ -514,20 +526,24 @@ class AnalysisGetHoverParams implements HasToJson {
|
| * analysis.getHover result
|
| *
|
| * {
|
| - * "hovers": List<HoverInformation>
|
| + * "hovers": optional List<HoverInformation>
|
| * }
|
| */
|
| class AnalysisGetHoverResult implements HasToJson {
|
| /**
|
| - * The hover information associated with the location. The list will be empty
|
| - * if no information could be determined for the location. The list can
|
| - * contain multiple items if the file is being analyzed in multiple contexts
|
| - * in conflicting ways (such as a part that is included in multiple
|
| + * The hover information associated with the location. The list will be
|
| + * omitted if no information could be determined for the location. The list
|
| + * can contain multiple items if the file is being analyzed in multiple
|
| + * contexts in conflicting ways (such as a part that is included in multiple
|
| * libraries).
|
| */
|
| List<HoverInformation> hovers;
|
|
|
| - AnalysisGetHoverResult(this.hovers);
|
| + AnalysisGetHoverResult({this.hovers}) {
|
| + if (hovers == null) {
|
| + hovers = <HoverInformation>[];
|
| + }
|
| + }
|
|
|
| factory AnalysisGetHoverResult.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {
|
| if (json == null) {
|
| @@ -538,9 +554,9 @@ class AnalysisGetHoverResult implements HasToJson {
|
| if (json.containsKey("hovers")) {
|
| hovers = jsonDecoder._decodeList(jsonPath + ".hovers", json["hovers"], (String jsonPath, Object json) => new HoverInformation.fromJson(jsonDecoder, jsonPath, json));
|
| } else {
|
| - throw jsonDecoder.missingKey(jsonPath, "hovers");
|
| + hovers = <HoverInformation>[];
|
| }
|
| - return new AnalysisGetHoverResult(hovers);
|
| + return new AnalysisGetHoverResult(hovers: hovers);
|
| } else {
|
| throw jsonDecoder.mismatch(jsonPath, "analysis.getHover result");
|
| }
|
| @@ -553,7 +569,9 @@ class AnalysisGetHoverResult implements HasToJson {
|
|
|
| Map<String, dynamic> toJson() {
|
| Map<String, dynamic> result = {};
|
| - result["hovers"] = hovers.map((HoverInformation value) => value.toJson()).toList();
|
| + if (hovers.isNotEmpty) {
|
| + result["hovers"] = hovers.map((HoverInformation value) => value.toJson()).toList();
|
| + }
|
| return result;
|
| }
|
|
|
| @@ -584,8 +602,8 @@ class AnalysisGetHoverResult implements HasToJson {
|
| * analysis.setAnalysisRoots params
|
| *
|
| * {
|
| - * "included": List<FilePath>
|
| - * "excluded": List<FilePath>
|
| + * "included": optional List<FilePath>
|
| + * "excluded": optional List<FilePath>
|
| * }
|
| */
|
| class AnalysisSetAnalysisRootsParams implements HasToJson {
|
| @@ -600,7 +618,14 @@ class AnalysisSetAnalysisRootsParams implements HasToJson {
|
| */
|
| List<String> excluded;
|
|
|
| - AnalysisSetAnalysisRootsParams(this.included, this.excluded);
|
| + AnalysisSetAnalysisRootsParams({this.included, this.excluded}) {
|
| + if (included == null) {
|
| + included = <String>[];
|
| + }
|
| + if (excluded == null) {
|
| + excluded = <String>[];
|
| + }
|
| + }
|
|
|
| factory AnalysisSetAnalysisRootsParams.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {
|
| if (json == null) {
|
| @@ -611,15 +636,15 @@ class AnalysisSetAnalysisRootsParams implements HasToJson {
|
| if (json.containsKey("included")) {
|
| included = jsonDecoder._decodeList(jsonPath + ".included", json["included"], jsonDecoder._decodeString);
|
| } else {
|
| - throw jsonDecoder.missingKey(jsonPath, "included");
|
| + included = <String>[];
|
| }
|
| List<String> excluded;
|
| if (json.containsKey("excluded")) {
|
| excluded = jsonDecoder._decodeList(jsonPath + ".excluded", json["excluded"], jsonDecoder._decodeString);
|
| } else {
|
| - throw jsonDecoder.missingKey(jsonPath, "excluded");
|
| + excluded = <String>[];
|
| }
|
| - return new AnalysisSetAnalysisRootsParams(included, excluded);
|
| + return new AnalysisSetAnalysisRootsParams(included: included, excluded: excluded);
|
| } else {
|
| throw jsonDecoder.mismatch(jsonPath, "analysis.setAnalysisRoots params");
|
| }
|
| @@ -632,8 +657,12 @@ class AnalysisSetAnalysisRootsParams implements HasToJson {
|
|
|
| Map<String, dynamic> toJson() {
|
| Map<String, dynamic> result = {};
|
| - result["included"] = included;
|
| - result["excluded"] = excluded;
|
| + if (included.isNotEmpty) {
|
| + result["included"] = included;
|
| + }
|
| + if (excluded.isNotEmpty) {
|
| + result["excluded"] = excluded;
|
| + }
|
| return result;
|
| }
|
|
|
| @@ -666,7 +695,7 @@ class AnalysisSetAnalysisRootsParams implements HasToJson {
|
| * analysis.setPriorityFiles params
|
| *
|
| * {
|
| - * "files": List<FilePath>
|
| + * "files": optional List<FilePath>
|
| * }
|
| */
|
| class AnalysisSetPriorityFilesParams implements HasToJson {
|
| @@ -675,7 +704,11 @@ class AnalysisSetPriorityFilesParams implements HasToJson {
|
| */
|
| List<String> files;
|
|
|
| - AnalysisSetPriorityFilesParams(this.files);
|
| + AnalysisSetPriorityFilesParams({this.files}) {
|
| + if (files == null) {
|
| + files = <String>[];
|
| + }
|
| + }
|
|
|
| factory AnalysisSetPriorityFilesParams.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {
|
| if (json == null) {
|
| @@ -686,9 +719,9 @@ class AnalysisSetPriorityFilesParams implements HasToJson {
|
| if (json.containsKey("files")) {
|
| files = jsonDecoder._decodeList(jsonPath + ".files", json["files"], jsonDecoder._decodeString);
|
| } else {
|
| - throw jsonDecoder.missingKey(jsonPath, "files");
|
| + files = <String>[];
|
| }
|
| - return new AnalysisSetPriorityFilesParams(files);
|
| + return new AnalysisSetPriorityFilesParams(files: files);
|
| } else {
|
| throw jsonDecoder.mismatch(jsonPath, "analysis.setPriorityFiles params");
|
| }
|
| @@ -701,7 +734,9 @@ class AnalysisSetPriorityFilesParams implements HasToJson {
|
|
|
| Map<String, dynamic> toJson() {
|
| Map<String, dynamic> result = {};
|
| - result["files"] = files;
|
| + if (files.isNotEmpty) {
|
| + result["files"] = files;
|
| + }
|
| return result;
|
| }
|
|
|
| @@ -933,7 +968,7 @@ class AnalysisUpdateOptionsParams implements HasToJson {
|
| *
|
| * {
|
| * "file": FilePath
|
| - * "errors": List<AnalysisError>
|
| + * "errors": optional List<AnalysisError>
|
| * }
|
| */
|
| class AnalysisErrorsParams implements HasToJson {
|
| @@ -947,7 +982,11 @@ class AnalysisErrorsParams implements HasToJson {
|
| */
|
| List<AnalysisError> errors;
|
|
|
| - AnalysisErrorsParams(this.file, this.errors);
|
| + AnalysisErrorsParams(this.file, {this.errors}) {
|
| + if (errors == null) {
|
| + errors = <AnalysisError>[];
|
| + }
|
| + }
|
|
|
| factory AnalysisErrorsParams.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {
|
| if (json == null) {
|
| @@ -964,9 +1003,9 @@ class AnalysisErrorsParams implements HasToJson {
|
| if (json.containsKey("errors")) {
|
| errors = jsonDecoder._decodeList(jsonPath + ".errors", json["errors"], (String jsonPath, Object json) => new AnalysisError.fromJson(jsonDecoder, jsonPath, json));
|
| } else {
|
| - throw jsonDecoder.missingKey(jsonPath, "errors");
|
| + errors = <AnalysisError>[];
|
| }
|
| - return new AnalysisErrorsParams(file, errors);
|
| + return new AnalysisErrorsParams(file, errors: errors);
|
| } else {
|
| throw jsonDecoder.mismatch(jsonPath, "analysis.errors params");
|
| }
|
| @@ -980,7 +1019,9 @@ class AnalysisErrorsParams implements HasToJson {
|
| Map<String, dynamic> toJson() {
|
| Map<String, dynamic> result = {};
|
| result["file"] = file;
|
| - result["errors"] = errors.map((AnalysisError value) => value.toJson()).toList();
|
| + if (errors.isNotEmpty) {
|
| + result["errors"] = errors.map((AnalysisError value) => value.toJson()).toList();
|
| + }
|
| return result;
|
| }
|
|
|
| @@ -1009,7 +1050,7 @@ class AnalysisErrorsParams implements HasToJson {
|
| * analysis.flushResults params
|
| *
|
| * {
|
| - * "files": List<FilePath>
|
| + * "files": optional List<FilePath>
|
| * }
|
| */
|
| class AnalysisFlushResultsParams implements HasToJson {
|
| @@ -1018,7 +1059,11 @@ class AnalysisFlushResultsParams implements HasToJson {
|
| */
|
| List<String> files;
|
|
|
| - AnalysisFlushResultsParams(this.files);
|
| + AnalysisFlushResultsParams({this.files}) {
|
| + if (files == null) {
|
| + files = <String>[];
|
| + }
|
| + }
|
|
|
| factory AnalysisFlushResultsParams.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {
|
| if (json == null) {
|
| @@ -1029,9 +1074,9 @@ class AnalysisFlushResultsParams implements HasToJson {
|
| if (json.containsKey("files")) {
|
| files = jsonDecoder._decodeList(jsonPath + ".files", json["files"], jsonDecoder._decodeString);
|
| } else {
|
| - throw jsonDecoder.missingKey(jsonPath, "files");
|
| + files = <String>[];
|
| }
|
| - return new AnalysisFlushResultsParams(files);
|
| + return new AnalysisFlushResultsParams(files: files);
|
| } else {
|
| throw jsonDecoder.mismatch(jsonPath, "analysis.flushResults params");
|
| }
|
| @@ -1044,7 +1089,9 @@ class AnalysisFlushResultsParams implements HasToJson {
|
|
|
| Map<String, dynamic> toJson() {
|
| Map<String, dynamic> result = {};
|
| - result["files"] = files;
|
| + if (files.isNotEmpty) {
|
| + result["files"] = files;
|
| + }
|
| return result;
|
| }
|
|
|
| @@ -1072,7 +1119,7 @@ class AnalysisFlushResultsParams implements HasToJson {
|
| *
|
| * {
|
| * "file": FilePath
|
| - * "regions": List<FoldingRegion>
|
| + * "regions": optional List<FoldingRegion>
|
| * }
|
| */
|
| class AnalysisFoldingParams implements HasToJson {
|
| @@ -1086,7 +1133,11 @@ class AnalysisFoldingParams implements HasToJson {
|
| */
|
| List<FoldingRegion> regions;
|
|
|
| - AnalysisFoldingParams(this.file, this.regions);
|
| + AnalysisFoldingParams(this.file, {this.regions}) {
|
| + if (regions == null) {
|
| + regions = <FoldingRegion>[];
|
| + }
|
| + }
|
|
|
| factory AnalysisFoldingParams.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {
|
| if (json == null) {
|
| @@ -1103,9 +1154,9 @@ class AnalysisFoldingParams implements HasToJson {
|
| if (json.containsKey("regions")) {
|
| regions = jsonDecoder._decodeList(jsonPath + ".regions", json["regions"], (String jsonPath, Object json) => new FoldingRegion.fromJson(jsonDecoder, jsonPath, json));
|
| } else {
|
| - throw jsonDecoder.missingKey(jsonPath, "regions");
|
| + regions = <FoldingRegion>[];
|
| }
|
| - return new AnalysisFoldingParams(file, regions);
|
| + return new AnalysisFoldingParams(file, regions: regions);
|
| } else {
|
| throw jsonDecoder.mismatch(jsonPath, "analysis.folding params");
|
| }
|
| @@ -1119,7 +1170,9 @@ class AnalysisFoldingParams implements HasToJson {
|
| Map<String, dynamic> toJson() {
|
| Map<String, dynamic> result = {};
|
| result["file"] = file;
|
| - result["regions"] = regions.map((FoldingRegion value) => value.toJson()).toList();
|
| + if (regions.isNotEmpty) {
|
| + result["regions"] = regions.map((FoldingRegion value) => value.toJson()).toList();
|
| + }
|
| return result;
|
| }
|
|
|
| @@ -1149,7 +1202,7 @@ class AnalysisFoldingParams implements HasToJson {
|
| *
|
| * {
|
| * "file": FilePath
|
| - * "regions": List<HighlightRegion>
|
| + * "regions": optional List<HighlightRegion>
|
| * }
|
| */
|
| class AnalysisHighlightsParams implements HasToJson {
|
| @@ -1167,7 +1220,11 @@ class AnalysisHighlightsParams implements HasToJson {
|
| */
|
| List<HighlightRegion> regions;
|
|
|
| - AnalysisHighlightsParams(this.file, this.regions);
|
| + AnalysisHighlightsParams(this.file, {this.regions}) {
|
| + if (regions == null) {
|
| + regions = <HighlightRegion>[];
|
| + }
|
| + }
|
|
|
| factory AnalysisHighlightsParams.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {
|
| if (json == null) {
|
| @@ -1184,9 +1241,9 @@ class AnalysisHighlightsParams implements HasToJson {
|
| if (json.containsKey("regions")) {
|
| regions = jsonDecoder._decodeList(jsonPath + ".regions", json["regions"], (String jsonPath, Object json) => new HighlightRegion.fromJson(jsonDecoder, jsonPath, json));
|
| } else {
|
| - throw jsonDecoder.missingKey(jsonPath, "regions");
|
| + regions = <HighlightRegion>[];
|
| }
|
| - return new AnalysisHighlightsParams(file, regions);
|
| + return new AnalysisHighlightsParams(file, regions: regions);
|
| } else {
|
| throw jsonDecoder.mismatch(jsonPath, "analysis.highlights params");
|
| }
|
| @@ -1200,7 +1257,9 @@ class AnalysisHighlightsParams implements HasToJson {
|
| Map<String, dynamic> toJson() {
|
| Map<String, dynamic> result = {};
|
| result["file"] = file;
|
| - result["regions"] = regions.map((HighlightRegion value) => value.toJson()).toList();
|
| + if (regions.isNotEmpty) {
|
| + result["regions"] = regions.map((HighlightRegion value) => value.toJson()).toList();
|
| + }
|
| return result;
|
| }
|
|
|
| @@ -1230,7 +1289,7 @@ class AnalysisHighlightsParams implements HasToJson {
|
| *
|
| * {
|
| * "file": FilePath
|
| - * "regions": List<NavigationRegion>
|
| + * "regions": optional List<NavigationRegion>
|
| * }
|
| */
|
| class AnalysisNavigationParams implements HasToJson {
|
| @@ -1249,7 +1308,11 @@ class AnalysisNavigationParams implements HasToJson {
|
| */
|
| List<NavigationRegion> regions;
|
|
|
| - AnalysisNavigationParams(this.file, this.regions);
|
| + AnalysisNavigationParams(this.file, {this.regions}) {
|
| + if (regions == null) {
|
| + regions = <NavigationRegion>[];
|
| + }
|
| + }
|
|
|
| factory AnalysisNavigationParams.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {
|
| if (json == null) {
|
| @@ -1266,9 +1329,9 @@ class AnalysisNavigationParams implements HasToJson {
|
| if (json.containsKey("regions")) {
|
| regions = jsonDecoder._decodeList(jsonPath + ".regions", json["regions"], (String jsonPath, Object json) => new NavigationRegion.fromJson(jsonDecoder, jsonPath, json));
|
| } else {
|
| - throw jsonDecoder.missingKey(jsonPath, "regions");
|
| + regions = <NavigationRegion>[];
|
| }
|
| - return new AnalysisNavigationParams(file, regions);
|
| + return new AnalysisNavigationParams(file, regions: regions);
|
| } else {
|
| throw jsonDecoder.mismatch(jsonPath, "analysis.navigation params");
|
| }
|
| @@ -1282,7 +1345,9 @@ class AnalysisNavigationParams implements HasToJson {
|
| Map<String, dynamic> toJson() {
|
| Map<String, dynamic> result = {};
|
| result["file"] = file;
|
| - result["regions"] = regions.map((NavigationRegion value) => value.toJson()).toList();
|
| + if (regions.isNotEmpty) {
|
| + result["regions"] = regions.map((NavigationRegion value) => value.toJson()).toList();
|
| + }
|
| return result;
|
| }
|
|
|
| @@ -1312,7 +1377,7 @@ class AnalysisNavigationParams implements HasToJson {
|
| *
|
| * {
|
| * "file": FilePath
|
| - * "occurrences": List<Occurrences>
|
| + * "occurrences": optional List<Occurrences>
|
| * }
|
| */
|
| class AnalysisOccurrencesParams implements HasToJson {
|
| @@ -1326,7 +1391,11 @@ class AnalysisOccurrencesParams implements HasToJson {
|
| */
|
| List<Occurrences> occurrences;
|
|
|
| - AnalysisOccurrencesParams(this.file, this.occurrences);
|
| + AnalysisOccurrencesParams(this.file, {this.occurrences}) {
|
| + if (occurrences == null) {
|
| + occurrences = <Occurrences>[];
|
| + }
|
| + }
|
|
|
| factory AnalysisOccurrencesParams.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {
|
| if (json == null) {
|
| @@ -1343,9 +1412,9 @@ class AnalysisOccurrencesParams implements HasToJson {
|
| if (json.containsKey("occurrences")) {
|
| occurrences = jsonDecoder._decodeList(jsonPath + ".occurrences", json["occurrences"], (String jsonPath, Object json) => new Occurrences.fromJson(jsonDecoder, jsonPath, json));
|
| } else {
|
| - throw jsonDecoder.missingKey(jsonPath, "occurrences");
|
| + occurrences = <Occurrences>[];
|
| }
|
| - return new AnalysisOccurrencesParams(file, occurrences);
|
| + return new AnalysisOccurrencesParams(file, occurrences: occurrences);
|
| } else {
|
| throw jsonDecoder.mismatch(jsonPath, "analysis.occurrences params");
|
| }
|
| @@ -1359,7 +1428,9 @@ class AnalysisOccurrencesParams implements HasToJson {
|
| Map<String, dynamic> toJson() {
|
| Map<String, dynamic> result = {};
|
| result["file"] = file;
|
| - result["occurrences"] = occurrences.map((Occurrences value) => value.toJson()).toList();
|
| + if (occurrences.isNotEmpty) {
|
| + result["occurrences"] = occurrences.map((Occurrences value) => value.toJson()).toList();
|
| + }
|
| return result;
|
| }
|
|
|
| @@ -1466,7 +1537,7 @@ class AnalysisOutlineParams implements HasToJson {
|
| *
|
| * {
|
| * "file": FilePath
|
| - * "overrides": List<Override>
|
| + * "overrides": optional List<Override>
|
| * }
|
| */
|
| class AnalysisOverridesParams implements HasToJson {
|
| @@ -1480,7 +1551,11 @@ class AnalysisOverridesParams implements HasToJson {
|
| */
|
| List<Override> overrides;
|
|
|
| - AnalysisOverridesParams(this.file, this.overrides);
|
| + AnalysisOverridesParams(this.file, {this.overrides}) {
|
| + if (overrides == null) {
|
| + overrides = <Override>[];
|
| + }
|
| + }
|
|
|
| factory AnalysisOverridesParams.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {
|
| if (json == null) {
|
| @@ -1497,9 +1572,9 @@ class AnalysisOverridesParams implements HasToJson {
|
| if (json.containsKey("overrides")) {
|
| overrides = jsonDecoder._decodeList(jsonPath + ".overrides", json["overrides"], (String jsonPath, Object json) => new Override.fromJson(jsonDecoder, jsonPath, json));
|
| } else {
|
| - throw jsonDecoder.missingKey(jsonPath, "overrides");
|
| + overrides = <Override>[];
|
| }
|
| - return new AnalysisOverridesParams(file, overrides);
|
| + return new AnalysisOverridesParams(file, overrides: overrides);
|
| } else {
|
| throw jsonDecoder.mismatch(jsonPath, "analysis.overrides params");
|
| }
|
| @@ -1513,7 +1588,9 @@ class AnalysisOverridesParams implements HasToJson {
|
| Map<String, dynamic> toJson() {
|
| Map<String, dynamic> result = {};
|
| result["file"] = file;
|
| - result["overrides"] = overrides.map((Override value) => value.toJson()).toList();
|
| + if (overrides.isNotEmpty) {
|
| + result["overrides"] = overrides.map((Override value) => value.toJson()).toList();
|
| + }
|
| return result;
|
| }
|
|
|
| @@ -1692,7 +1769,7 @@ class CompletionGetSuggestionsResult implements HasToJson {
|
| * "id": CompletionId
|
| * "replacementOffset": int
|
| * "replacementLength": int
|
| - * "results": List<CompletionSuggestion>
|
| + * "results": optional List<CompletionSuggestion>
|
| * "last": bool
|
| * }
|
| */
|
| @@ -1732,7 +1809,11 @@ class CompletionResultsParams implements HasToJson {
|
| */
|
| bool last;
|
|
|
| - CompletionResultsParams(this.id, this.replacementOffset, this.replacementLength, this.results, this.last);
|
| + CompletionResultsParams(this.id, this.replacementOffset, this.replacementLength, this.last, {this.results}) {
|
| + if (results == null) {
|
| + results = <CompletionSuggestion>[];
|
| + }
|
| + }
|
|
|
| factory CompletionResultsParams.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {
|
| if (json == null) {
|
| @@ -1761,7 +1842,7 @@ class CompletionResultsParams implements HasToJson {
|
| if (json.containsKey("results")) {
|
| results = jsonDecoder._decodeList(jsonPath + ".results", json["results"], (String jsonPath, Object json) => new CompletionSuggestion.fromJson(jsonDecoder, jsonPath, json));
|
| } else {
|
| - throw jsonDecoder.missingKey(jsonPath, "results");
|
| + results = <CompletionSuggestion>[];
|
| }
|
| bool last;
|
| if (json.containsKey("last")) {
|
| @@ -1769,7 +1850,7 @@ class CompletionResultsParams implements HasToJson {
|
| } else {
|
| throw jsonDecoder.missingKey(jsonPath, "last");
|
| }
|
| - return new CompletionResultsParams(id, replacementOffset, replacementLength, results, last);
|
| + return new CompletionResultsParams(id, replacementOffset, replacementLength, last, results: results);
|
| } else {
|
| throw jsonDecoder.mismatch(jsonPath, "completion.results params");
|
| }
|
| @@ -1785,7 +1866,9 @@ class CompletionResultsParams implements HasToJson {
|
| result["id"] = id;
|
| result["replacementOffset"] = replacementOffset;
|
| result["replacementLength"] = replacementLength;
|
| - result["results"] = results.map((CompletionSuggestion value) => value.toJson()).toList();
|
| + if (results.isNotEmpty) {
|
| + result["results"] = results.map((CompletionSuggestion value) => value.toJson()).toList();
|
| + }
|
| result["last"] = last;
|
| return result;
|
| }
|
| @@ -2499,7 +2582,11 @@ class SearchGetTypeHierarchyResult implements HasToJson {
|
| */
|
| List<TypeHierarchyItem> hierarchyItems;
|
|
|
| - SearchGetTypeHierarchyResult({this.hierarchyItems});
|
| + SearchGetTypeHierarchyResult({this.hierarchyItems}) {
|
| + if (hierarchyItems == null) {
|
| + hierarchyItems = <TypeHierarchyItem>[];
|
| + }
|
| + }
|
|
|
| factory SearchGetTypeHierarchyResult.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {
|
| if (json == null) {
|
| @@ -2509,6 +2596,8 @@ class SearchGetTypeHierarchyResult implements HasToJson {
|
| List<TypeHierarchyItem> hierarchyItems;
|
| if (json.containsKey("hierarchyItems")) {
|
| hierarchyItems = jsonDecoder._decodeList(jsonPath + ".hierarchyItems", json["hierarchyItems"], (String jsonPath, Object json) => new TypeHierarchyItem.fromJson(jsonDecoder, jsonPath, json));
|
| + } else {
|
| + hierarchyItems = <TypeHierarchyItem>[];
|
| }
|
| return new SearchGetTypeHierarchyResult(hierarchyItems: hierarchyItems);
|
| } else {
|
| @@ -2523,7 +2612,7 @@ class SearchGetTypeHierarchyResult implements HasToJson {
|
|
|
| Map<String, dynamic> toJson() {
|
| Map<String, dynamic> result = {};
|
| - if (hierarchyItems != null) {
|
| + if (hierarchyItems.isNotEmpty) {
|
| result["hierarchyItems"] = hierarchyItems.map((TypeHierarchyItem value) => value.toJson()).toList();
|
| }
|
| return result;
|
| @@ -2557,7 +2646,7 @@ class SearchGetTypeHierarchyResult implements HasToJson {
|
| *
|
| * {
|
| * "id": SearchId
|
| - * "results": List<SearchResult>
|
| + * "results": optional List<SearchResult>
|
| * "last": bool
|
| * }
|
| */
|
| @@ -2578,7 +2667,11 @@ class SearchResultsParams implements HasToJson {
|
| */
|
| bool last;
|
|
|
| - SearchResultsParams(this.id, this.results, this.last);
|
| + SearchResultsParams(this.id, this.last, {this.results}) {
|
| + if (results == null) {
|
| + results = <SearchResult>[];
|
| + }
|
| + }
|
|
|
| factory SearchResultsParams.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {
|
| if (json == null) {
|
| @@ -2595,7 +2688,7 @@ class SearchResultsParams implements HasToJson {
|
| if (json.containsKey("results")) {
|
| results = jsonDecoder._decodeList(jsonPath + ".results", json["results"], (String jsonPath, Object json) => new SearchResult.fromJson(jsonDecoder, jsonPath, json));
|
| } else {
|
| - throw jsonDecoder.missingKey(jsonPath, "results");
|
| + results = <SearchResult>[];
|
| }
|
| bool last;
|
| if (json.containsKey("last")) {
|
| @@ -2603,7 +2696,7 @@ class SearchResultsParams implements HasToJson {
|
| } else {
|
| throw jsonDecoder.missingKey(jsonPath, "last");
|
| }
|
| - return new SearchResultsParams(id, results, last);
|
| + return new SearchResultsParams(id, last, results: results);
|
| } else {
|
| throw jsonDecoder.mismatch(jsonPath, "search.results params");
|
| }
|
| @@ -2617,7 +2710,9 @@ class SearchResultsParams implements HasToJson {
|
| Map<String, dynamic> toJson() {
|
| Map<String, dynamic> result = {};
|
| result["id"] = id;
|
| - result["results"] = results.map((SearchResult value) => value.toJson()).toList();
|
| + if (results.isNotEmpty) {
|
| + result["results"] = results.map((SearchResult value) => value.toJson()).toList();
|
| + }
|
| result["last"] = last;
|
| return result;
|
| }
|
| @@ -2745,7 +2840,7 @@ class EditGetAssistsParams implements HasToJson {
|
| * edit.getAssists result
|
| *
|
| * {
|
| - * "assists": List<SourceChange>
|
| + * "assists": optional List<SourceChange>
|
| * }
|
| */
|
| class EditGetAssistsResult implements HasToJson {
|
| @@ -2754,7 +2849,11 @@ class EditGetAssistsResult implements HasToJson {
|
| */
|
| List<SourceChange> assists;
|
|
|
| - EditGetAssistsResult(this.assists);
|
| + EditGetAssistsResult({this.assists}) {
|
| + if (assists == null) {
|
| + assists = <SourceChange>[];
|
| + }
|
| + }
|
|
|
| factory EditGetAssistsResult.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {
|
| if (json == null) {
|
| @@ -2765,9 +2864,9 @@ class EditGetAssistsResult implements HasToJson {
|
| if (json.containsKey("assists")) {
|
| assists = jsonDecoder._decodeList(jsonPath + ".assists", json["assists"], (String jsonPath, Object json) => new SourceChange.fromJson(jsonDecoder, jsonPath, json));
|
| } else {
|
| - throw jsonDecoder.missingKey(jsonPath, "assists");
|
| + assists = <SourceChange>[];
|
| }
|
| - return new EditGetAssistsResult(assists);
|
| + return new EditGetAssistsResult(assists: assists);
|
| } else {
|
| throw jsonDecoder.mismatch(jsonPath, "edit.getAssists result");
|
| }
|
| @@ -2780,7 +2879,9 @@ class EditGetAssistsResult implements HasToJson {
|
|
|
| Map<String, dynamic> toJson() {
|
| Map<String, dynamic> result = {};
|
| - result["assists"] = assists.map((SourceChange value) => value.toJson()).toList();
|
| + if (assists.isNotEmpty) {
|
| + result["assists"] = assists.map((SourceChange value) => value.toJson()).toList();
|
| + }
|
| return result;
|
| }
|
|
|
| @@ -2907,7 +3008,7 @@ class EditGetAvailableRefactoringsParams implements HasToJson {
|
| * edit.getAvailableRefactorings result
|
| *
|
| * {
|
| - * "kinds": List<RefactoringKind>
|
| + * "kinds": optional List<RefactoringKind>
|
| * }
|
| */
|
| class EditGetAvailableRefactoringsResult implements HasToJson {
|
| @@ -2916,7 +3017,11 @@ class EditGetAvailableRefactoringsResult implements HasToJson {
|
| */
|
| List<RefactoringKind> kinds;
|
|
|
| - EditGetAvailableRefactoringsResult(this.kinds);
|
| + EditGetAvailableRefactoringsResult({this.kinds}) {
|
| + if (kinds == null) {
|
| + kinds = <RefactoringKind>[];
|
| + }
|
| + }
|
|
|
| factory EditGetAvailableRefactoringsResult.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {
|
| if (json == null) {
|
| @@ -2927,9 +3032,9 @@ class EditGetAvailableRefactoringsResult implements HasToJson {
|
| if (json.containsKey("kinds")) {
|
| kinds = jsonDecoder._decodeList(jsonPath + ".kinds", json["kinds"], (String jsonPath, Object json) => new RefactoringKind.fromJson(jsonDecoder, jsonPath, json));
|
| } else {
|
| - throw jsonDecoder.missingKey(jsonPath, "kinds");
|
| + kinds = <RefactoringKind>[];
|
| }
|
| - return new EditGetAvailableRefactoringsResult(kinds);
|
| + return new EditGetAvailableRefactoringsResult(kinds: kinds);
|
| } else {
|
| throw jsonDecoder.mismatch(jsonPath, "edit.getAvailableRefactorings result");
|
| }
|
| @@ -2942,7 +3047,9 @@ class EditGetAvailableRefactoringsResult implements HasToJson {
|
|
|
| Map<String, dynamic> toJson() {
|
| Map<String, dynamic> result = {};
|
| - result["kinds"] = kinds.map((RefactoringKind value) => value.toJson()).toList();
|
| + if (kinds.isNotEmpty) {
|
| + result["kinds"] = kinds.map((RefactoringKind value) => value.toJson()).toList();
|
| + }
|
| return result;
|
| }
|
|
|
| @@ -3054,7 +3161,7 @@ class EditGetFixesParams implements HasToJson {
|
| * edit.getFixes result
|
| *
|
| * {
|
| - * "fixes": List<ErrorFixes>
|
| + * "fixes": optional List<ErrorFixes>
|
| * }
|
| */
|
| class EditGetFixesResult implements HasToJson {
|
| @@ -3068,7 +3175,11 @@ class EditGetFixesResult implements HasToJson {
|
| */
|
| List<ErrorFixes> fixes;
|
|
|
| - EditGetFixesResult(this.fixes);
|
| + EditGetFixesResult({this.fixes}) {
|
| + if (fixes == null) {
|
| + fixes = <ErrorFixes>[];
|
| + }
|
| + }
|
|
|
| factory EditGetFixesResult.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {
|
| if (json == null) {
|
| @@ -3079,9 +3190,9 @@ class EditGetFixesResult implements HasToJson {
|
| if (json.containsKey("fixes")) {
|
| fixes = jsonDecoder._decodeList(jsonPath + ".fixes", json["fixes"], (String jsonPath, Object json) => new ErrorFixes.fromJson(jsonDecoder, jsonPath, json));
|
| } else {
|
| - throw jsonDecoder.missingKey(jsonPath, "fixes");
|
| + fixes = <ErrorFixes>[];
|
| }
|
| - return new EditGetFixesResult(fixes);
|
| + return new EditGetFixesResult(fixes: fixes);
|
| } else {
|
| throw jsonDecoder.mismatch(jsonPath, "edit.getFixes result");
|
| }
|
| @@ -3094,7 +3205,9 @@ class EditGetFixesResult implements HasToJson {
|
|
|
| Map<String, dynamic> toJson() {
|
| Map<String, dynamic> result = {};
|
| - result["fixes"] = fixes.map((ErrorFixes value) => value.toJson()).toList();
|
| + if (fixes.isNotEmpty) {
|
| + result["fixes"] = fixes.map((ErrorFixes value) => value.toJson()).toList();
|
| + }
|
| return result;
|
| }
|
|
|
| @@ -3271,7 +3384,7 @@ class EditGetRefactoringParams implements HasToJson {
|
| * edit.getRefactoring result
|
| *
|
| * {
|
| - * "status": List<RefactoringProblem>
|
| + * "status": optional List<RefactoringProblem>
|
| * "feedback": optional object
|
| * "change": optional SourceChange
|
| * "potentialEdits": optional List<String>
|
| @@ -3310,7 +3423,14 @@ class EditGetRefactoringResult implements HasToJson {
|
| */
|
| List<String> potentialEdits;
|
|
|
| - EditGetRefactoringResult(this.status, {this.feedback, this.change, this.potentialEdits});
|
| + EditGetRefactoringResult({this.status, this.feedback, this.change, this.potentialEdits}) {
|
| + if (status == null) {
|
| + status = <RefactoringProblem>[];
|
| + }
|
| + if (potentialEdits == null) {
|
| + potentialEdits = <String>[];
|
| + }
|
| + }
|
|
|
| factory EditGetRefactoringResult.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {
|
| if (json == null) {
|
| @@ -3321,7 +3441,7 @@ class EditGetRefactoringResult implements HasToJson {
|
| if (json.containsKey("status")) {
|
| status = jsonDecoder._decodeList(jsonPath + ".status", json["status"], (String jsonPath, Object json) => new RefactoringProblem.fromJson(jsonDecoder, jsonPath, json));
|
| } else {
|
| - throw jsonDecoder.missingKey(jsonPath, "status");
|
| + status = <RefactoringProblem>[];
|
| }
|
| Object feedback;
|
| if (json.containsKey("feedback")) {
|
| @@ -3334,8 +3454,10 @@ class EditGetRefactoringResult implements HasToJson {
|
| List<String> potentialEdits;
|
| if (json.containsKey("potentialEdits")) {
|
| potentialEdits = jsonDecoder._decodeList(jsonPath + ".potentialEdits", json["potentialEdits"], jsonDecoder._decodeString);
|
| + } else {
|
| + potentialEdits = <String>[];
|
| }
|
| - return new EditGetRefactoringResult(status, feedback: feedback, change: change, potentialEdits: potentialEdits);
|
| + return new EditGetRefactoringResult(status: status, feedback: feedback, change: change, potentialEdits: potentialEdits);
|
| } else {
|
| throw jsonDecoder.mismatch(jsonPath, "edit.getRefactoring result");
|
| }
|
| @@ -3348,14 +3470,16 @@ class EditGetRefactoringResult implements HasToJson {
|
|
|
| Map<String, dynamic> toJson() {
|
| Map<String, dynamic> result = {};
|
| - result["status"] = status.map((RefactoringProblem value) => value.toJson()).toList();
|
| + if (status.isNotEmpty) {
|
| + result["status"] = status.map((RefactoringProblem value) => value.toJson()).toList();
|
| + }
|
| if (feedback != null) {
|
| result["feedback"] = feedback;
|
| }
|
| if (change != null) {
|
| result["change"] = change.toJson();
|
| }
|
| - if (potentialEdits != null) {
|
| + if (potentialEdits.isNotEmpty) {
|
| result["potentialEdits"] = potentialEdits;
|
| }
|
| return result;
|
| @@ -3771,7 +3895,7 @@ class DebugMapUriResult implements HasToJson {
|
| * debug.setSubscriptions params
|
| *
|
| * {
|
| - * "subscriptions": List<DebugService>
|
| + * "subscriptions": optional List<DebugService>
|
| * }
|
| */
|
| class DebugSetSubscriptionsParams implements HasToJson {
|
| @@ -3780,7 +3904,11 @@ class DebugSetSubscriptionsParams implements HasToJson {
|
| */
|
| List<DebugService> subscriptions;
|
|
|
| - DebugSetSubscriptionsParams(this.subscriptions);
|
| + DebugSetSubscriptionsParams({this.subscriptions}) {
|
| + if (subscriptions == null) {
|
| + subscriptions = <DebugService>[];
|
| + }
|
| + }
|
|
|
| factory DebugSetSubscriptionsParams.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {
|
| if (json == null) {
|
| @@ -3791,9 +3919,9 @@ class DebugSetSubscriptionsParams implements HasToJson {
|
| if (json.containsKey("subscriptions")) {
|
| subscriptions = jsonDecoder._decodeList(jsonPath + ".subscriptions", json["subscriptions"], (String jsonPath, Object json) => new DebugService.fromJson(jsonDecoder, jsonPath, json));
|
| } else {
|
| - throw jsonDecoder.missingKey(jsonPath, "subscriptions");
|
| + subscriptions = <DebugService>[];
|
| }
|
| - return new DebugSetSubscriptionsParams(subscriptions);
|
| + return new DebugSetSubscriptionsParams(subscriptions: subscriptions);
|
| } else {
|
| throw jsonDecoder.mismatch(jsonPath, "debug.setSubscriptions params");
|
| }
|
| @@ -3806,7 +3934,9 @@ class DebugSetSubscriptionsParams implements HasToJson {
|
|
|
| Map<String, dynamic> toJson() {
|
| Map<String, dynamic> result = {};
|
| - result["subscriptions"] = subscriptions.map((DebugService value) => value.toJson()).toList();
|
| + if (subscriptions.isNotEmpty) {
|
| + result["subscriptions"] = subscriptions.map((DebugService value) => value.toJson()).toList();
|
| + }
|
| return result;
|
| }
|
|
|
| @@ -3837,7 +3967,7 @@ class DebugSetSubscriptionsParams implements HasToJson {
|
| * debug.launchData params
|
| *
|
| * {
|
| - * "executables": List<ExecutableFile>
|
| + * "executables": optional List<ExecutableFile>
|
| * "dartToHtml": Map<FilePath, List<FilePath>>
|
| * "htmlToDart": Map<FilePath, List<FilePath>>
|
| * }
|
| @@ -3861,7 +3991,11 @@ class DebugLaunchDataParams implements HasToJson {
|
| */
|
| Map<String, List<String>> htmlToDart;
|
|
|
| - DebugLaunchDataParams(this.executables, this.dartToHtml, this.htmlToDart);
|
| + DebugLaunchDataParams(this.dartToHtml, this.htmlToDart, {this.executables}) {
|
| + if (executables == null) {
|
| + executables = <ExecutableFile>[];
|
| + }
|
| + }
|
|
|
| factory DebugLaunchDataParams.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {
|
| if (json == null) {
|
| @@ -3872,7 +4006,7 @@ class DebugLaunchDataParams implements HasToJson {
|
| if (json.containsKey("executables")) {
|
| executables = jsonDecoder._decodeList(jsonPath + ".executables", json["executables"], (String jsonPath, Object json) => new ExecutableFile.fromJson(jsonDecoder, jsonPath, json));
|
| } else {
|
| - throw jsonDecoder.missingKey(jsonPath, "executables");
|
| + executables = <ExecutableFile>[];
|
| }
|
| Map<String, List<String>> dartToHtml;
|
| if (json.containsKey("dartToHtml")) {
|
| @@ -3886,7 +4020,7 @@ class DebugLaunchDataParams implements HasToJson {
|
| } else {
|
| throw jsonDecoder.missingKey(jsonPath, "htmlToDart");
|
| }
|
| - return new DebugLaunchDataParams(executables, dartToHtml, htmlToDart);
|
| + return new DebugLaunchDataParams(dartToHtml, htmlToDart, executables: executables);
|
| } else {
|
| throw jsonDecoder.mismatch(jsonPath, "debug.launchData params");
|
| }
|
| @@ -3899,7 +4033,9 @@ class DebugLaunchDataParams implements HasToJson {
|
|
|
| Map<String, dynamic> toJson() {
|
| Map<String, dynamic> result = {};
|
| - result["executables"] = executables.map((ExecutableFile value) => value.toJson()).toList();
|
| + if (executables.isNotEmpty) {
|
| + result["executables"] = executables.map((ExecutableFile value) => value.toJson()).toList();
|
| + }
|
| result["dartToHtml"] = dartToHtml;
|
| result["htmlToDart"] = htmlToDart;
|
| return result;
|
| @@ -4379,7 +4515,7 @@ class AnalysisStatus implements HasToJson {
|
| *
|
| * {
|
| * "type": "change"
|
| - * "edits": List<SourceEdit>
|
| + * "edits": optional List<SourceEdit>
|
| * }
|
| */
|
| class ChangeContentOverlay implements HasToJson {
|
| @@ -4388,7 +4524,11 @@ class ChangeContentOverlay implements HasToJson {
|
| */
|
| List<SourceEdit> edits;
|
|
|
| - ChangeContentOverlay(this.edits);
|
| + ChangeContentOverlay({this.edits}) {
|
| + if (edits == null) {
|
| + edits = <SourceEdit>[];
|
| + }
|
| + }
|
|
|
| factory ChangeContentOverlay.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {
|
| if (json == null) {
|
| @@ -4402,9 +4542,9 @@ class ChangeContentOverlay implements HasToJson {
|
| if (json.containsKey("edits")) {
|
| edits = jsonDecoder._decodeList(jsonPath + ".edits", json["edits"], (String jsonPath, Object json) => new SourceEdit.fromJson(jsonDecoder, jsonPath, json));
|
| } else {
|
| - throw jsonDecoder.missingKey(jsonPath, "edits");
|
| + edits = <SourceEdit>[];
|
| }
|
| - return new ChangeContentOverlay(edits);
|
| + return new ChangeContentOverlay(edits: edits);
|
| } else {
|
| throw jsonDecoder.mismatch(jsonPath, "ChangeContentOverlay");
|
| }
|
| @@ -4413,7 +4553,9 @@ class ChangeContentOverlay implements HasToJson {
|
| Map<String, dynamic> toJson() {
|
| Map<String, dynamic> result = {};
|
| result["type"] = "change";
|
| - result["edits"] = edits.map((SourceEdit value) => value.toJson()).toList();
|
| + if (edits.isNotEmpty) {
|
| + result["edits"] = edits.map((SourceEdit value) => value.toJson()).toList();
|
| + }
|
| return result;
|
| }
|
|
|
| @@ -4614,7 +4756,14 @@ class CompletionSuggestion implements HasToJson {
|
| */
|
| String parameterType;
|
|
|
| - CompletionSuggestion(this.kind, this.relevance, this.completion, this.selectionOffset, this.selectionLength, this.isDeprecated, this.isPotential, {this.docSummary, this.docComplete, this.declaringType, this.returnType, this.parameterNames, this.parameterTypes, this.requiredParameterCount, this.positionalParameterCount, this.parameterName, this.parameterType});
|
| + CompletionSuggestion(this.kind, this.relevance, this.completion, this.selectionOffset, this.selectionLength, this.isDeprecated, this.isPotential, {this.docSummary, this.docComplete, this.declaringType, this.returnType, this.parameterNames, this.parameterTypes, this.requiredParameterCount, this.positionalParameterCount, this.parameterName, this.parameterType}) {
|
| + if (parameterNames == null) {
|
| + parameterNames = <String>[];
|
| + }
|
| + if (parameterTypes == null) {
|
| + parameterTypes = <String>[];
|
| + }
|
| + }
|
|
|
| factory CompletionSuggestion.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {
|
| if (json == null) {
|
| @@ -4682,10 +4831,14 @@ class CompletionSuggestion implements HasToJson {
|
| List<String> parameterNames;
|
| if (json.containsKey("parameterNames")) {
|
| parameterNames = jsonDecoder._decodeList(jsonPath + ".parameterNames", json["parameterNames"], jsonDecoder._decodeString);
|
| + } else {
|
| + parameterNames = <String>[];
|
| }
|
| List<String> parameterTypes;
|
| if (json.containsKey("parameterTypes")) {
|
| parameterTypes = jsonDecoder._decodeList(jsonPath + ".parameterTypes", json["parameterTypes"], jsonDecoder._decodeString);
|
| + } else {
|
| + parameterTypes = <String>[];
|
| }
|
| int requiredParameterCount;
|
| if (json.containsKey("requiredParameterCount")) {
|
| @@ -4730,10 +4883,10 @@ class CompletionSuggestion implements HasToJson {
|
| if (returnType != null) {
|
| result["returnType"] = returnType;
|
| }
|
| - if (parameterNames != null) {
|
| + if (parameterNames.isNotEmpty) {
|
| result["parameterNames"] = parameterNames;
|
| }
|
| - if (parameterTypes != null) {
|
| + if (parameterTypes.isNotEmpty) {
|
| result["parameterTypes"] = parameterTypes;
|
| }
|
| if (requiredParameterCount != null) {
|
| @@ -5374,7 +5527,7 @@ class Error implements HasToJson {
|
| *
|
| * {
|
| * "error": AnalysisError
|
| - * "fixes": List<SourceChange>
|
| + * "fixes": optional List<SourceChange>
|
| * }
|
| */
|
| class ErrorFixes implements HasToJson {
|
| @@ -5388,7 +5541,11 @@ class ErrorFixes implements HasToJson {
|
| */
|
| List<SourceChange> fixes;
|
|
|
| - ErrorFixes(this.error, this.fixes);
|
| + ErrorFixes(this.error, {this.fixes}) {
|
| + if (fixes == null) {
|
| + fixes = <SourceChange>[];
|
| + }
|
| + }
|
|
|
| factory ErrorFixes.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {
|
| if (json == null) {
|
| @@ -5405,9 +5562,9 @@ class ErrorFixes implements HasToJson {
|
| if (json.containsKey("fixes")) {
|
| fixes = jsonDecoder._decodeList(jsonPath + ".fixes", json["fixes"], (String jsonPath, Object json) => new SourceChange.fromJson(jsonDecoder, jsonPath, json));
|
| } else {
|
| - throw jsonDecoder.missingKey(jsonPath, "fixes");
|
| + fixes = <SourceChange>[];
|
| }
|
| - return new ErrorFixes(error, fixes);
|
| + return new ErrorFixes(error, fixes: fixes);
|
| } else {
|
| throw jsonDecoder.mismatch(jsonPath, "ErrorFixes");
|
| }
|
| @@ -5416,7 +5573,9 @@ class ErrorFixes implements HasToJson {
|
| Map<String, dynamic> toJson() {
|
| Map<String, dynamic> result = {};
|
| result["error"] = error.toJson();
|
| - result["fixes"] = fixes.map((SourceChange value) => value.toJson()).toList();
|
| + if (fixes.isNotEmpty) {
|
| + result["fixes"] = fixes.map((SourceChange value) => value.toJson()).toList();
|
| + }
|
| return result;
|
| }
|
|
|
| @@ -6329,9 +6488,9 @@ class HoverInformation implements HasToJson {
|
| * LinkedEditGroup
|
| *
|
| * {
|
| - * "positions": List<Position>
|
| + * "positions": optional List<Position>
|
| * "length": int
|
| - * "suggestions": List<LinkedEditSuggestion>
|
| + * "suggestions": optional List<LinkedEditSuggestion>
|
| * }
|
| */
|
| class LinkedEditGroup implements HasToJson {
|
| @@ -6351,7 +6510,14 @@ class LinkedEditGroup implements HasToJson {
|
| */
|
| List<LinkedEditSuggestion> suggestions;
|
|
|
| - LinkedEditGroup(this.positions, this.length, this.suggestions);
|
| + LinkedEditGroup(this.length, {this.positions, this.suggestions}) {
|
| + if (positions == null) {
|
| + positions = <Position>[];
|
| + }
|
| + if (suggestions == null) {
|
| + suggestions = <LinkedEditSuggestion>[];
|
| + }
|
| + }
|
|
|
| factory LinkedEditGroup.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {
|
| if (json == null) {
|
| @@ -6362,7 +6528,7 @@ class LinkedEditGroup implements HasToJson {
|
| if (json.containsKey("positions")) {
|
| positions = jsonDecoder._decodeList(jsonPath + ".positions", json["positions"], (String jsonPath, Object json) => new Position.fromJson(jsonDecoder, jsonPath, json));
|
| } else {
|
| - throw jsonDecoder.missingKey(jsonPath, "positions");
|
| + positions = <Position>[];
|
| }
|
| int length;
|
| if (json.containsKey("length")) {
|
| @@ -6374,9 +6540,9 @@ class LinkedEditGroup implements HasToJson {
|
| if (json.containsKey("suggestions")) {
|
| suggestions = jsonDecoder._decodeList(jsonPath + ".suggestions", json["suggestions"], (String jsonPath, Object json) => new LinkedEditSuggestion.fromJson(jsonDecoder, jsonPath, json));
|
| } else {
|
| - throw jsonDecoder.missingKey(jsonPath, "suggestions");
|
| + suggestions = <LinkedEditSuggestion>[];
|
| }
|
| - return new LinkedEditGroup(positions, length, suggestions);
|
| + return new LinkedEditGroup(length, positions: positions, suggestions: suggestions);
|
| } else {
|
| throw jsonDecoder.mismatch(jsonPath, "LinkedEditGroup");
|
| }
|
| @@ -6384,9 +6550,13 @@ class LinkedEditGroup implements HasToJson {
|
|
|
| Map<String, dynamic> toJson() {
|
| Map<String, dynamic> result = {};
|
| - result["positions"] = positions.map((Position value) => value.toJson()).toList();
|
| + if (positions.isNotEmpty) {
|
| + result["positions"] = positions.map((Position value) => value.toJson()).toList();
|
| + }
|
| result["length"] = length;
|
| - result["suggestions"] = suggestions.map((LinkedEditSuggestion value) => value.toJson()).toList();
|
| + if (suggestions.isNotEmpty) {
|
| + result["suggestions"] = suggestions.map((LinkedEditSuggestion value) => value.toJson()).toList();
|
| + }
|
| return result;
|
| }
|
|
|
| @@ -6676,7 +6846,7 @@ class Location implements HasToJson {
|
| * {
|
| * "offset": int
|
| * "length": int
|
| - * "targets": List<Element>
|
| + * "targets": optional List<Element>
|
| * }
|
| */
|
| class NavigationRegion implements HasToJson {
|
| @@ -6696,7 +6866,11 @@ class NavigationRegion implements HasToJson {
|
| */
|
| List<Element> targets;
|
|
|
| - NavigationRegion(this.offset, this.length, this.targets);
|
| + NavigationRegion(this.offset, this.length, {this.targets}) {
|
| + if (targets == null) {
|
| + targets = <Element>[];
|
| + }
|
| + }
|
|
|
| factory NavigationRegion.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {
|
| if (json == null) {
|
| @@ -6719,9 +6893,9 @@ class NavigationRegion implements HasToJson {
|
| if (json.containsKey("targets")) {
|
| targets = jsonDecoder._decodeList(jsonPath + ".targets", json["targets"], (String jsonPath, Object json) => new Element.fromJson(jsonDecoder, jsonPath, json));
|
| } else {
|
| - throw jsonDecoder.missingKey(jsonPath, "targets");
|
| + targets = <Element>[];
|
| }
|
| - return new NavigationRegion(offset, length, targets);
|
| + return new NavigationRegion(offset, length, targets: targets);
|
| } else {
|
| throw jsonDecoder.mismatch(jsonPath, "NavigationRegion");
|
| }
|
| @@ -6731,7 +6905,9 @@ class NavigationRegion implements HasToJson {
|
| Map<String, dynamic> result = {};
|
| result["offset"] = offset;
|
| result["length"] = length;
|
| - result["targets"] = targets.map((Element value) => value.toJson()).toList();
|
| + if (targets.isNotEmpty) {
|
| + result["targets"] = targets.map((Element value) => value.toJson()).toList();
|
| + }
|
| return result;
|
| }
|
|
|
| @@ -6763,7 +6939,7 @@ class NavigationRegion implements HasToJson {
|
| *
|
| * {
|
| * "element": Element
|
| - * "offsets": List<int>
|
| + * "offsets": optional List<int>
|
| * "length": int
|
| * }
|
| */
|
| @@ -6783,7 +6959,11 @@ class Occurrences implements HasToJson {
|
| */
|
| int length;
|
|
|
| - Occurrences(this.element, this.offsets, this.length);
|
| + Occurrences(this.element, this.length, {this.offsets}) {
|
| + if (offsets == null) {
|
| + offsets = <int>[];
|
| + }
|
| + }
|
|
|
| factory Occurrences.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {
|
| if (json == null) {
|
| @@ -6800,7 +6980,7 @@ class Occurrences implements HasToJson {
|
| if (json.containsKey("offsets")) {
|
| offsets = jsonDecoder._decodeList(jsonPath + ".offsets", json["offsets"], jsonDecoder._decodeInt);
|
| } else {
|
| - throw jsonDecoder.missingKey(jsonPath, "offsets");
|
| + offsets = <int>[];
|
| }
|
| int length;
|
| if (json.containsKey("length")) {
|
| @@ -6808,7 +6988,7 @@ class Occurrences implements HasToJson {
|
| } else {
|
| throw jsonDecoder.missingKey(jsonPath, "length");
|
| }
|
| - return new Occurrences(element, offsets, length);
|
| + return new Occurrences(element, length, offsets: offsets);
|
| } else {
|
| throw jsonDecoder.mismatch(jsonPath, "Occurrences");
|
| }
|
| @@ -6817,7 +6997,9 @@ class Occurrences implements HasToJson {
|
| Map<String, dynamic> toJson() {
|
| Map<String, dynamic> result = {};
|
| result["element"] = element.toJson();
|
| - result["offsets"] = offsets;
|
| + if (offsets.isNotEmpty) {
|
| + result["offsets"] = offsets;
|
| + }
|
| result["length"] = length;
|
| return result;
|
| }
|
| @@ -6880,7 +7062,11 @@ class Outline implements HasToJson {
|
| */
|
| List<Outline> children;
|
|
|
| - Outline(this.element, this.offset, this.length, {this.children});
|
| + Outline(this.element, this.offset, this.length, {this.children}) {
|
| + if (children == null) {
|
| + children = <Outline>[];
|
| + }
|
| + }
|
|
|
| factory Outline.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {
|
| if (json == null) {
|
| @@ -6908,6 +7094,8 @@ class Outline implements HasToJson {
|
| List<Outline> children;
|
| if (json.containsKey("children")) {
|
| children = jsonDecoder._decodeList(jsonPath + ".children", json["children"], (String jsonPath, Object json) => new Outline.fromJson(jsonDecoder, jsonPath, json));
|
| + } else {
|
| + children = <Outline>[];
|
| }
|
| return new Outline(element, offset, length, children: children);
|
| } else {
|
| @@ -6920,7 +7108,7 @@ class Outline implements HasToJson {
|
| result["element"] = element.toJson();
|
| result["offset"] = offset;
|
| result["length"] = length;
|
| - if (children != null) {
|
| + if (children.isNotEmpty) {
|
| result["children"] = children.map((Outline value) => value.toJson()).toList();
|
| }
|
| return result;
|
| @@ -6986,7 +7174,11 @@ class Override implements HasToJson {
|
| */
|
| List<OverriddenMember> interfaceMembers;
|
|
|
| - Override(this.offset, this.length, {this.superclassMember, this.interfaceMembers});
|
| + Override(this.offset, this.length, {this.superclassMember, this.interfaceMembers}) {
|
| + if (interfaceMembers == null) {
|
| + interfaceMembers = <OverriddenMember>[];
|
| + }
|
| + }
|
|
|
| factory Override.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {
|
| if (json == null) {
|
| @@ -7012,6 +7204,8 @@ class Override implements HasToJson {
|
| List<OverriddenMember> interfaceMembers;
|
| if (json.containsKey("interfaceMembers")) {
|
| interfaceMembers = jsonDecoder._decodeList(jsonPath + ".interfaceMembers", json["interfaceMembers"], (String jsonPath, Object json) => new OverriddenMember.fromJson(jsonDecoder, jsonPath, json));
|
| + } else {
|
| + interfaceMembers = <OverriddenMember>[];
|
| }
|
| return new Override(offset, length, superclassMember: superclassMember, interfaceMembers: interfaceMembers);
|
| } else {
|
| @@ -7026,7 +7220,7 @@ class Override implements HasToJson {
|
| if (superclassMember != null) {
|
| result["superclassMember"] = superclassMember.toJson();
|
| }
|
| - if (interfaceMembers != null) {
|
| + if (interfaceMembers.isNotEmpty) {
|
| result["interfaceMembers"] = interfaceMembers.map((OverriddenMember value) => value.toJson()).toList();
|
| }
|
| return result;
|
| @@ -7645,7 +7839,7 @@ class RemoveContentOverlay implements HasToJson {
|
| * "location": Location
|
| * "kind": SearchResultKind
|
| * "isPotential": bool
|
| - * "path": List<Element>
|
| + * "path": optional List<Element>
|
| * }
|
| */
|
| class SearchResult implements HasToJson {
|
| @@ -7674,7 +7868,11 @@ class SearchResult implements HasToJson {
|
| */
|
| List<Element> path;
|
|
|
| - SearchResult(this.location, this.kind, this.isPotential, this.path);
|
| + SearchResult(this.location, this.kind, this.isPotential, {this.path}) {
|
| + if (path == null) {
|
| + path = <Element>[];
|
| + }
|
| + }
|
|
|
| factory SearchResult.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {
|
| if (json == null) {
|
| @@ -7703,9 +7901,9 @@ class SearchResult implements HasToJson {
|
| if (json.containsKey("path")) {
|
| path = jsonDecoder._decodeList(jsonPath + ".path", json["path"], (String jsonPath, Object json) => new Element.fromJson(jsonDecoder, jsonPath, json));
|
| } else {
|
| - throw jsonDecoder.missingKey(jsonPath, "path");
|
| + path = <Element>[];
|
| }
|
| - return new SearchResult(location, kind, isPotential, path);
|
| + return new SearchResult(location, kind, isPotential, path: path);
|
| } else {
|
| throw jsonDecoder.mismatch(jsonPath, "SearchResult");
|
| }
|
| @@ -7722,7 +7920,9 @@ class SearchResult implements HasToJson {
|
| result["location"] = location.toJson();
|
| result["kind"] = kind.toJson();
|
| result["isPotential"] = isPotential;
|
| - result["path"] = path.map((Element value) => value.toJson()).toList();
|
| + if (path.isNotEmpty) {
|
| + result["path"] = path.map((Element value) => value.toJson()).toList();
|
| + }
|
| return result;
|
| }
|
|
|
| @@ -7892,8 +8092,8 @@ class ServerService {
|
| *
|
| * {
|
| * "message": String
|
| - * "edits": List<SourceFileEdit>
|
| - * "linkedEditGroups": List<LinkedEditGroup>
|
| + * "edits": optional List<SourceFileEdit>
|
| + * "linkedEditGroups": optional List<LinkedEditGroup>
|
| * "selection": optional Position
|
| * }
|
| */
|
| @@ -7919,7 +8119,14 @@ class SourceChange implements HasToJson {
|
| */
|
| Position selection;
|
|
|
| - SourceChange(this.message, this.edits, this.linkedEditGroups, {this.selection});
|
| + SourceChange(this.message, {this.edits, this.linkedEditGroups, this.selection}) {
|
| + if (edits == null) {
|
| + edits = <SourceFileEdit>[];
|
| + }
|
| + if (linkedEditGroups == null) {
|
| + linkedEditGroups = <LinkedEditGroup>[];
|
| + }
|
| + }
|
|
|
| factory SourceChange.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {
|
| if (json == null) {
|
| @@ -7936,19 +8143,19 @@ class SourceChange implements HasToJson {
|
| if (json.containsKey("edits")) {
|
| edits = jsonDecoder._decodeList(jsonPath + ".edits", json["edits"], (String jsonPath, Object json) => new SourceFileEdit.fromJson(jsonDecoder, jsonPath, json));
|
| } else {
|
| - throw jsonDecoder.missingKey(jsonPath, "edits");
|
| + edits = <SourceFileEdit>[];
|
| }
|
| List<LinkedEditGroup> linkedEditGroups;
|
| if (json.containsKey("linkedEditGroups")) {
|
| linkedEditGroups = jsonDecoder._decodeList(jsonPath + ".linkedEditGroups", json["linkedEditGroups"], (String jsonPath, Object json) => new LinkedEditGroup.fromJson(jsonDecoder, jsonPath, json));
|
| } else {
|
| - throw jsonDecoder.missingKey(jsonPath, "linkedEditGroups");
|
| + linkedEditGroups = <LinkedEditGroup>[];
|
| }
|
| Position selection;
|
| if (json.containsKey("selection")) {
|
| selection = new Position.fromJson(jsonDecoder, jsonPath + ".selection", json["selection"]);
|
| }
|
| - return new SourceChange(message, edits, linkedEditGroups, selection: selection);
|
| + return new SourceChange(message, edits: edits, linkedEditGroups: linkedEditGroups, selection: selection);
|
| } else {
|
| throw jsonDecoder.mismatch(jsonPath, "SourceChange");
|
| }
|
| @@ -7957,8 +8164,12 @@ class SourceChange implements HasToJson {
|
| Map<String, dynamic> toJson() {
|
| Map<String, dynamic> result = {};
|
| result["message"] = message;
|
| - result["edits"] = edits.map((SourceFileEdit value) => value.toJson()).toList();
|
| - result["linkedEditGroups"] = linkedEditGroups.map((LinkedEditGroup value) => value.toJson()).toList();
|
| + if (edits.isNotEmpty) {
|
| + result["edits"] = edits.map((SourceFileEdit value) => value.toJson()).toList();
|
| + }
|
| + if (linkedEditGroups.isNotEmpty) {
|
| + result["linkedEditGroups"] = linkedEditGroups.map((LinkedEditGroup value) => value.toJson()).toList();
|
| + }
|
| if (selection != null) {
|
| result["selection"] = selection.toJson();
|
| }
|
| @@ -8127,7 +8338,7 @@ class SourceEdit implements HasToJson {
|
| *
|
| * {
|
| * "file": FilePath
|
| - * "edits": List<SourceEdit>
|
| + * "edits": optional List<SourceEdit>
|
| * }
|
| */
|
| class SourceFileEdit implements HasToJson {
|
| @@ -8141,7 +8352,11 @@ class SourceFileEdit implements HasToJson {
|
| */
|
| List<SourceEdit> edits;
|
|
|
| - SourceFileEdit(this.file, this.edits);
|
| + SourceFileEdit(this.file, {this.edits}) {
|
| + if (edits == null) {
|
| + edits = <SourceEdit>[];
|
| + }
|
| + }
|
|
|
| factory SourceFileEdit.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {
|
| if (json == null) {
|
| @@ -8158,9 +8373,9 @@ class SourceFileEdit implements HasToJson {
|
| if (json.containsKey("edits")) {
|
| edits = jsonDecoder._decodeList(jsonPath + ".edits", json["edits"], (String jsonPath, Object json) => new SourceEdit.fromJson(jsonDecoder, jsonPath, json));
|
| } else {
|
| - throw jsonDecoder.missingKey(jsonPath, "edits");
|
| + edits = <SourceEdit>[];
|
| }
|
| - return new SourceFileEdit(file, edits);
|
| + return new SourceFileEdit(file, edits: edits);
|
| } else {
|
| throw jsonDecoder.mismatch(jsonPath, "SourceFileEdit");
|
| }
|
| @@ -8169,7 +8384,9 @@ class SourceFileEdit implements HasToJson {
|
| Map<String, dynamic> toJson() {
|
| Map<String, dynamic> result = {};
|
| result["file"] = file;
|
| - result["edits"] = edits.map((SourceEdit value) => value.toJson()).toList();
|
| + if (edits.isNotEmpty) {
|
| + result["edits"] = edits.map((SourceEdit value) => value.toJson()).toList();
|
| + }
|
| return result;
|
| }
|
|
|
| @@ -8213,9 +8430,9 @@ class SourceFileEdit implements HasToJson {
|
| * "displayName": optional String
|
| * "memberElement": optional Element
|
| * "superclass": optional int
|
| - * "interfaces": List<int>
|
| - * "mixins": List<int>
|
| - * "subclasses": List<int>
|
| + * "interfaces": optional List<int>
|
| + * "mixins": optional List<int>
|
| + * "subclasses": optional List<int>
|
| * }
|
| */
|
| class TypeHierarchyItem implements HasToJson {
|
| @@ -8265,7 +8482,17 @@ class TypeHierarchyItem implements HasToJson {
|
| */
|
| List<int> subclasses;
|
|
|
| - TypeHierarchyItem(this.classElement, this.interfaces, this.mixins, this.subclasses, {this.displayName, this.memberElement, this.superclass});
|
| + TypeHierarchyItem(this.classElement, {this.displayName, this.memberElement, this.superclass, this.interfaces, this.mixins, this.subclasses}) {
|
| + if (interfaces == null) {
|
| + interfaces = <int>[];
|
| + }
|
| + if (mixins == null) {
|
| + mixins = <int>[];
|
| + }
|
| + if (subclasses == null) {
|
| + subclasses = <int>[];
|
| + }
|
| + }
|
|
|
| factory TypeHierarchyItem.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {
|
| if (json == null) {
|
| @@ -8294,21 +8521,21 @@ class TypeHierarchyItem implements HasToJson {
|
| if (json.containsKey("interfaces")) {
|
| interfaces = jsonDecoder._decodeList(jsonPath + ".interfaces", json["interfaces"], jsonDecoder._decodeInt);
|
| } else {
|
| - throw jsonDecoder.missingKey(jsonPath, "interfaces");
|
| + interfaces = <int>[];
|
| }
|
| List<int> mixins;
|
| if (json.containsKey("mixins")) {
|
| mixins = jsonDecoder._decodeList(jsonPath + ".mixins", json["mixins"], jsonDecoder._decodeInt);
|
| } else {
|
| - throw jsonDecoder.missingKey(jsonPath, "mixins");
|
| + mixins = <int>[];
|
| }
|
| List<int> subclasses;
|
| if (json.containsKey("subclasses")) {
|
| subclasses = jsonDecoder._decodeList(jsonPath + ".subclasses", json["subclasses"], jsonDecoder._decodeInt);
|
| } else {
|
| - throw jsonDecoder.missingKey(jsonPath, "subclasses");
|
| + subclasses = <int>[];
|
| }
|
| - return new TypeHierarchyItem(classElement, interfaces, mixins, subclasses, displayName: displayName, memberElement: memberElement, superclass: superclass);
|
| + return new TypeHierarchyItem(classElement, displayName: displayName, memberElement: memberElement, superclass: superclass, interfaces: interfaces, mixins: mixins, subclasses: subclasses);
|
| } else {
|
| throw jsonDecoder.mismatch(jsonPath, "TypeHierarchyItem");
|
| }
|
| @@ -8326,9 +8553,15 @@ class TypeHierarchyItem implements HasToJson {
|
| if (superclass != null) {
|
| result["superclass"] = superclass;
|
| }
|
| - result["interfaces"] = interfaces;
|
| - result["mixins"] = mixins;
|
| - result["subclasses"] = subclasses;
|
| + if (interfaces.isNotEmpty) {
|
| + result["interfaces"] = interfaces;
|
| + }
|
| + if (mixins.isNotEmpty) {
|
| + result["mixins"] = mixins;
|
| + }
|
| + if (subclasses.isNotEmpty) {
|
| + result["subclasses"] = subclasses;
|
| + }
|
| return result;
|
| }
|
|
|
| @@ -8367,9 +8600,9 @@ class TypeHierarchyItem implements HasToJson {
|
| * extractLocalVariable feedback
|
| *
|
| * {
|
| - * "names": List<String>
|
| - * "offsets": List<int>
|
| - * "lengths": List<int>
|
| + * "names": optional List<String>
|
| + * "offsets": optional List<int>
|
| + * "lengths": optional List<int>
|
| * }
|
| */
|
| class ExtractLocalVariableFeedback implements HasToJson {
|
| @@ -8392,7 +8625,17 @@ class ExtractLocalVariableFeedback implements HasToJson {
|
| */
|
| List<int> lengths;
|
|
|
| - ExtractLocalVariableFeedback(this.names, this.offsets, this.lengths);
|
| + ExtractLocalVariableFeedback({this.names, this.offsets, this.lengths}) {
|
| + if (names == null) {
|
| + names = <String>[];
|
| + }
|
| + if (offsets == null) {
|
| + offsets = <int>[];
|
| + }
|
| + if (lengths == null) {
|
| + lengths = <int>[];
|
| + }
|
| + }
|
|
|
| factory ExtractLocalVariableFeedback.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {
|
| if (json == null) {
|
| @@ -8403,21 +8646,21 @@ class ExtractLocalVariableFeedback implements HasToJson {
|
| if (json.containsKey("names")) {
|
| names = jsonDecoder._decodeList(jsonPath + ".names", json["names"], jsonDecoder._decodeString);
|
| } else {
|
| - throw jsonDecoder.missingKey(jsonPath, "names");
|
| + names = <String>[];
|
| }
|
| List<int> offsets;
|
| if (json.containsKey("offsets")) {
|
| offsets = jsonDecoder._decodeList(jsonPath + ".offsets", json["offsets"], jsonDecoder._decodeInt);
|
| } else {
|
| - throw jsonDecoder.missingKey(jsonPath, "offsets");
|
| + offsets = <int>[];
|
| }
|
| List<int> lengths;
|
| if (json.containsKey("lengths")) {
|
| lengths = jsonDecoder._decodeList(jsonPath + ".lengths", json["lengths"], jsonDecoder._decodeInt);
|
| } else {
|
| - throw jsonDecoder.missingKey(jsonPath, "lengths");
|
| + lengths = <int>[];
|
| }
|
| - return new ExtractLocalVariableFeedback(names, offsets, lengths);
|
| + return new ExtractLocalVariableFeedback(names: names, offsets: offsets, lengths: lengths);
|
| } else {
|
| throw jsonDecoder.mismatch(jsonPath, "extractLocalVariable feedback");
|
| }
|
| @@ -8430,9 +8673,15 @@ class ExtractLocalVariableFeedback implements HasToJson {
|
|
|
| Map<String, dynamic> toJson() {
|
| Map<String, dynamic> result = {};
|
| - result["names"] = names;
|
| - result["offsets"] = offsets;
|
| - result["lengths"] = lengths;
|
| + if (names.isNotEmpty) {
|
| + result["names"] = names;
|
| + }
|
| + if (offsets.isNotEmpty) {
|
| + result["offsets"] = offsets;
|
| + }
|
| + if (lengths.isNotEmpty) {
|
| + result["lengths"] = lengths;
|
| + }
|
| return result;
|
| }
|
|
|
| @@ -8546,12 +8795,12 @@ class ExtractLocalVariableOptions implements HasToJson {
|
| * "offset": int
|
| * "length": int
|
| * "returnType": String
|
| - * "names": List<String>
|
| + * "names": optional List<String>
|
| * "canCreateGetter": bool
|
| - * "parameters": List<RefactoringMethodParameter>
|
| + * "parameters": optional List<RefactoringMethodParameter>
|
| * "occurrences": int
|
| - * "offsets": List<int>
|
| - * "lengths": List<int>
|
| + * "offsets": optional List<int>
|
| + * "lengths": optional List<int>
|
| * }
|
| */
|
| class ExtractMethodFeedback implements HasToJson {
|
| @@ -8606,7 +8855,20 @@ class ExtractMethodFeedback implements HasToJson {
|
| */
|
| List<int> lengths;
|
|
|
| - ExtractMethodFeedback(this.offset, this.length, this.returnType, this.names, this.canCreateGetter, this.parameters, this.occurrences, this.offsets, this.lengths);
|
| + ExtractMethodFeedback(this.offset, this.length, this.returnType, this.canCreateGetter, this.occurrences, {this.names, this.parameters, this.offsets, this.lengths}) {
|
| + if (names == null) {
|
| + names = <String>[];
|
| + }
|
| + if (parameters == null) {
|
| + parameters = <RefactoringMethodParameter>[];
|
| + }
|
| + if (offsets == null) {
|
| + offsets = <int>[];
|
| + }
|
| + if (lengths == null) {
|
| + lengths = <int>[];
|
| + }
|
| + }
|
|
|
| factory ExtractMethodFeedback.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {
|
| if (json == null) {
|
| @@ -8635,7 +8897,7 @@ class ExtractMethodFeedback implements HasToJson {
|
| if (json.containsKey("names")) {
|
| names = jsonDecoder._decodeList(jsonPath + ".names", json["names"], jsonDecoder._decodeString);
|
| } else {
|
| - throw jsonDecoder.missingKey(jsonPath, "names");
|
| + names = <String>[];
|
| }
|
| bool canCreateGetter;
|
| if (json.containsKey("canCreateGetter")) {
|
| @@ -8647,7 +8909,7 @@ class ExtractMethodFeedback implements HasToJson {
|
| if (json.containsKey("parameters")) {
|
| parameters = jsonDecoder._decodeList(jsonPath + ".parameters", json["parameters"], (String jsonPath, Object json) => new RefactoringMethodParameter.fromJson(jsonDecoder, jsonPath, json));
|
| } else {
|
| - throw jsonDecoder.missingKey(jsonPath, "parameters");
|
| + parameters = <RefactoringMethodParameter>[];
|
| }
|
| int occurrences;
|
| if (json.containsKey("occurrences")) {
|
| @@ -8659,15 +8921,15 @@ class ExtractMethodFeedback implements HasToJson {
|
| if (json.containsKey("offsets")) {
|
| offsets = jsonDecoder._decodeList(jsonPath + ".offsets", json["offsets"], jsonDecoder._decodeInt);
|
| } else {
|
| - throw jsonDecoder.missingKey(jsonPath, "offsets");
|
| + offsets = <int>[];
|
| }
|
| List<int> lengths;
|
| if (json.containsKey("lengths")) {
|
| lengths = jsonDecoder._decodeList(jsonPath + ".lengths", json["lengths"], jsonDecoder._decodeInt);
|
| } else {
|
| - throw jsonDecoder.missingKey(jsonPath, "lengths");
|
| + lengths = <int>[];
|
| }
|
| - return new ExtractMethodFeedback(offset, length, returnType, names, canCreateGetter, parameters, occurrences, offsets, lengths);
|
| + return new ExtractMethodFeedback(offset, length, returnType, canCreateGetter, occurrences, names: names, parameters: parameters, offsets: offsets, lengths: lengths);
|
| } else {
|
| throw jsonDecoder.mismatch(jsonPath, "extractMethod feedback");
|
| }
|
| @@ -8683,12 +8945,20 @@ class ExtractMethodFeedback implements HasToJson {
|
| result["offset"] = offset;
|
| result["length"] = length;
|
| result["returnType"] = returnType;
|
| - result["names"] = names;
|
| + if (names.isNotEmpty) {
|
| + result["names"] = names;
|
| + }
|
| result["canCreateGetter"] = canCreateGetter;
|
| - result["parameters"] = parameters.map((RefactoringMethodParameter value) => value.toJson()).toList();
|
| + if (parameters.isNotEmpty) {
|
| + result["parameters"] = parameters.map((RefactoringMethodParameter value) => value.toJson()).toList();
|
| + }
|
| result["occurrences"] = occurrences;
|
| - result["offsets"] = offsets;
|
| - result["lengths"] = lengths;
|
| + if (offsets.isNotEmpty) {
|
| + result["offsets"] = offsets;
|
| + }
|
| + if (lengths.isNotEmpty) {
|
| + result["lengths"] = lengths;
|
| + }
|
| return result;
|
| }
|
|
|
| @@ -8734,7 +9004,7 @@ class ExtractMethodFeedback implements HasToJson {
|
| * "returnType": String
|
| * "createGetter": bool
|
| * "name": String
|
| - * "parameters": List<RefactoringMethodParameter>
|
| + * "parameters": optional List<RefactoringMethodParameter>
|
| * "extractAll": bool
|
| * }
|
| */
|
| @@ -8776,7 +9046,11 @@ class ExtractMethodOptions implements HasToJson {
|
| */
|
| bool extractAll;
|
|
|
| - ExtractMethodOptions(this.returnType, this.createGetter, this.name, this.parameters, this.extractAll);
|
| + ExtractMethodOptions(this.returnType, this.createGetter, this.name, this.extractAll, {this.parameters}) {
|
| + if (parameters == null) {
|
| + parameters = <RefactoringMethodParameter>[];
|
| + }
|
| + }
|
|
|
| factory ExtractMethodOptions.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {
|
| if (json == null) {
|
| @@ -8805,7 +9079,7 @@ class ExtractMethodOptions implements HasToJson {
|
| if (json.containsKey("parameters")) {
|
| parameters = jsonDecoder._decodeList(jsonPath + ".parameters", json["parameters"], (String jsonPath, Object json) => new RefactoringMethodParameter.fromJson(jsonDecoder, jsonPath, json));
|
| } else {
|
| - throw jsonDecoder.missingKey(jsonPath, "parameters");
|
| + parameters = <RefactoringMethodParameter>[];
|
| }
|
| bool extractAll;
|
| if (json.containsKey("extractAll")) {
|
| @@ -8813,7 +9087,7 @@ class ExtractMethodOptions implements HasToJson {
|
| } else {
|
| throw jsonDecoder.missingKey(jsonPath, "extractAll");
|
| }
|
| - return new ExtractMethodOptions(returnType, createGetter, name, parameters, extractAll);
|
| + return new ExtractMethodOptions(returnType, createGetter, name, extractAll, parameters: parameters);
|
| } else {
|
| throw jsonDecoder.mismatch(jsonPath, "extractMethod options");
|
| }
|
| @@ -8829,7 +9103,9 @@ class ExtractMethodOptions implements HasToJson {
|
| result["returnType"] = returnType;
|
| result["createGetter"] = createGetter;
|
| result["name"] = name;
|
| - result["parameters"] = parameters.map((RefactoringMethodParameter value) => value.toJson()).toList();
|
| + if (parameters.isNotEmpty) {
|
| + result["parameters"] = parameters.map((RefactoringMethodParameter value) => value.toJson()).toList();
|
| + }
|
| result["extractAll"] = extractAll;
|
| return result;
|
| }
|
|
|