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

Side by Side Diff: pkg/analysis_server/lib/src/generated_protocol.dart

Issue 497393002: Make more use of generated code in analysis server. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 // 4 //
5 // This file has been automatically generated. Please do not edit it manually. 5 // This file has been automatically generated. Please do not edit it manually.
6 // To regenerate the file, use the script 6 // To regenerate the file, use the script
7 // "pkg/analysis_server/spec/generate_files". 7 // "pkg/analysis_server/spec/generate_files".
8 8
9 part of protocol2; 9 part of protocol2;
10 10
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 } 204 }
205 205
206 Map<String, dynamic> toJson() { 206 Map<String, dynamic> toJson() {
207 Map<String, dynamic> result = {}; 207 Map<String, dynamic> result = {};
208 result["fatal"] = fatal; 208 result["fatal"] = fatal;
209 result["message"] = message; 209 result["message"] = message;
210 result["stackTrace"] = stackTrace; 210 result["stackTrace"] = stackTrace;
211 return result; 211 return result;
212 } 212 }
213 213
214 Notification toNotification() {
215 return new Notification("server.error", toJson());
216 }
217
214 @override 218 @override
215 String toString() => JSON.encode(toJson()); 219 String toString() => JSON.encode(toJson());
216 220
217 @override 221 @override
218 bool operator==(other) { 222 bool operator==(other) {
219 if (other is ServerErrorParams) { 223 if (other is ServerErrorParams) {
220 return fatal == other.fatal && 224 return fatal == other.fatal &&
221 message == other.message && 225 message == other.message &&
222 stackTrace == other.stackTrace; 226 stackTrace == other.stackTrace;
223 } 227 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 } 275 }
272 276
273 Map<String, dynamic> toJson() { 277 Map<String, dynamic> toJson() {
274 Map<String, dynamic> result = {}; 278 Map<String, dynamic> result = {};
275 if (analysis != null) { 279 if (analysis != null) {
276 result["analysis"] = analysis.toJson(); 280 result["analysis"] = analysis.toJson();
277 } 281 }
278 return result; 282 return result;
279 } 283 }
280 284
285 Notification toNotification() {
286 return new Notification("server.status", toJson());
287 }
288
281 @override 289 @override
282 String toString() => JSON.encode(toJson()); 290 String toString() => JSON.encode(toJson());
283 291
284 @override 292 @override
285 bool operator==(other) { 293 bool operator==(other) {
286 if (other is ServerStatusParams) { 294 if (other is ServerStatusParams) {
287 return analysis == other.analysis; 295 return analysis == other.analysis;
288 } 296 }
289 return false; 297 return false;
290 } 298 }
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after
977 new ResponseDecoder(), "params", notification.params); 985 new ResponseDecoder(), "params", notification.params);
978 } 986 }
979 987
980 Map<String, dynamic> toJson() { 988 Map<String, dynamic> toJson() {
981 Map<String, dynamic> result = {}; 989 Map<String, dynamic> result = {};
982 result["file"] = file; 990 result["file"] = file;
983 result["errors"] = errors.map((AnalysisError value) => value.toJson()).toLis t(); 991 result["errors"] = errors.map((AnalysisError value) => value.toJson()).toLis t();
984 return result; 992 return result;
985 } 993 }
986 994
995 Notification toNotification() {
996 return new Notification("analysis.errors", toJson());
997 }
998
987 @override 999 @override
988 String toString() => JSON.encode(toJson()); 1000 String toString() => JSON.encode(toJson());
989 1001
990 @override 1002 @override
991 bool operator==(other) { 1003 bool operator==(other) {
992 if (other is AnalysisErrorsParams) { 1004 if (other is AnalysisErrorsParams) {
993 return file == other.file && 1005 return file == other.file &&
994 _listEqual(errors, other.errors, (AnalysisError a, AnalysisError b) => a == b); 1006 _listEqual(errors, other.errors, (AnalysisError a, AnalysisError b) => a == b);
995 } 1007 }
996 return false; 1008 return false;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1041 return new AnalysisFlushResultsParams.fromJson( 1053 return new AnalysisFlushResultsParams.fromJson(
1042 new ResponseDecoder(), "params", notification.params); 1054 new ResponseDecoder(), "params", notification.params);
1043 } 1055 }
1044 1056
1045 Map<String, dynamic> toJson() { 1057 Map<String, dynamic> toJson() {
1046 Map<String, dynamic> result = {}; 1058 Map<String, dynamic> result = {};
1047 result["files"] = files; 1059 result["files"] = files;
1048 return result; 1060 return result;
1049 } 1061 }
1050 1062
1063 Notification toNotification() {
1064 return new Notification("analysis.flushResults", toJson());
1065 }
1066
1051 @override 1067 @override
1052 String toString() => JSON.encode(toJson()); 1068 String toString() => JSON.encode(toJson());
1053 1069
1054 @override 1070 @override
1055 bool operator==(other) { 1071 bool operator==(other) {
1056 if (other is AnalysisFlushResultsParams) { 1072 if (other is AnalysisFlushResultsParams) {
1057 return _listEqual(files, other.files, (String a, String b) => a == b); 1073 return _listEqual(files, other.files, (String a, String b) => a == b);
1058 } 1074 }
1059 return false; 1075 return false;
1060 } 1076 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1116 new ResponseDecoder(), "params", notification.params); 1132 new ResponseDecoder(), "params", notification.params);
1117 } 1133 }
1118 1134
1119 Map<String, dynamic> toJson() { 1135 Map<String, dynamic> toJson() {
1120 Map<String, dynamic> result = {}; 1136 Map<String, dynamic> result = {};
1121 result["file"] = file; 1137 result["file"] = file;
1122 result["regions"] = regions.map((FoldingRegion value) => value.toJson()).toL ist(); 1138 result["regions"] = regions.map((FoldingRegion value) => value.toJson()).toL ist();
1123 return result; 1139 return result;
1124 } 1140 }
1125 1141
1142 Notification toNotification() {
1143 return new Notification("analysis.folding", toJson());
1144 }
1145
1126 @override 1146 @override
1127 String toString() => JSON.encode(toJson()); 1147 String toString() => JSON.encode(toJson());
1128 1148
1129 @override 1149 @override
1130 bool operator==(other) { 1150 bool operator==(other) {
1131 if (other is AnalysisFoldingParams) { 1151 if (other is AnalysisFoldingParams) {
1132 return file == other.file && 1152 return file == other.file &&
1133 _listEqual(regions, other.regions, (FoldingRegion a, FoldingRegion b) => a == b); 1153 _listEqual(regions, other.regions, (FoldingRegion a, FoldingRegion b) => a == b);
1134 } 1154 }
1135 return false; 1155 return false;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1197 new ResponseDecoder(), "params", notification.params); 1217 new ResponseDecoder(), "params", notification.params);
1198 } 1218 }
1199 1219
1200 Map<String, dynamic> toJson() { 1220 Map<String, dynamic> toJson() {
1201 Map<String, dynamic> result = {}; 1221 Map<String, dynamic> result = {};
1202 result["file"] = file; 1222 result["file"] = file;
1203 result["regions"] = regions.map((HighlightRegion value) => value.toJson()).t oList(); 1223 result["regions"] = regions.map((HighlightRegion value) => value.toJson()).t oList();
1204 return result; 1224 return result;
1205 } 1225 }
1206 1226
1227 Notification toNotification() {
1228 return new Notification("analysis.highlights", toJson());
1229 }
1230
1207 @override 1231 @override
1208 String toString() => JSON.encode(toJson()); 1232 String toString() => JSON.encode(toJson());
1209 1233
1210 @override 1234 @override
1211 bool operator==(other) { 1235 bool operator==(other) {
1212 if (other is AnalysisHighlightsParams) { 1236 if (other is AnalysisHighlightsParams) {
1213 return file == other.file && 1237 return file == other.file &&
1214 _listEqual(regions, other.regions, (HighlightRegion a, HighlightRegion b) => a == b); 1238 _listEqual(regions, other.regions, (HighlightRegion a, HighlightRegion b) => a == b);
1215 } 1239 }
1216 return false; 1240 return false;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1279 new ResponseDecoder(), "params", notification.params); 1303 new ResponseDecoder(), "params", notification.params);
1280 } 1304 }
1281 1305
1282 Map<String, dynamic> toJson() { 1306 Map<String, dynamic> toJson() {
1283 Map<String, dynamic> result = {}; 1307 Map<String, dynamic> result = {};
1284 result["file"] = file; 1308 result["file"] = file;
1285 result["regions"] = regions.map((NavigationRegion value) => value.toJson()). toList(); 1309 result["regions"] = regions.map((NavigationRegion value) => value.toJson()). toList();
1286 return result; 1310 return result;
1287 } 1311 }
1288 1312
1313 Notification toNotification() {
1314 return new Notification("analysis.navigation", toJson());
1315 }
1316
1289 @override 1317 @override
1290 String toString() => JSON.encode(toJson()); 1318 String toString() => JSON.encode(toJson());
1291 1319
1292 @override 1320 @override
1293 bool operator==(other) { 1321 bool operator==(other) {
1294 if (other is AnalysisNavigationParams) { 1322 if (other is AnalysisNavigationParams) {
1295 return file == other.file && 1323 return file == other.file &&
1296 _listEqual(regions, other.regions, (NavigationRegion a, NavigationRegi on b) => a == b); 1324 _listEqual(regions, other.regions, (NavigationRegion a, NavigationRegi on b) => a == b);
1297 } 1325 }
1298 return false; 1326 return false;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1356 new ResponseDecoder(), "params", notification.params); 1384 new ResponseDecoder(), "params", notification.params);
1357 } 1385 }
1358 1386
1359 Map<String, dynamic> toJson() { 1387 Map<String, dynamic> toJson() {
1360 Map<String, dynamic> result = {}; 1388 Map<String, dynamic> result = {};
1361 result["file"] = file; 1389 result["file"] = file;
1362 result["occurrences"] = occurrences.map((Occurrences value) => value.toJson( )).toList(); 1390 result["occurrences"] = occurrences.map((Occurrences value) => value.toJson( )).toList();
1363 return result; 1391 return result;
1364 } 1392 }
1365 1393
1394 Notification toNotification() {
1395 return new Notification("analysis.occurrences", toJson());
1396 }
1397
1366 @override 1398 @override
1367 String toString() => JSON.encode(toJson()); 1399 String toString() => JSON.encode(toJson());
1368 1400
1369 @override 1401 @override
1370 bool operator==(other) { 1402 bool operator==(other) {
1371 if (other is AnalysisOccurrencesParams) { 1403 if (other is AnalysisOccurrencesParams) {
1372 return file == other.file && 1404 return file == other.file &&
1373 _listEqual(occurrences, other.occurrences, (Occurrences a, Occurrences b) => a == b); 1405 _listEqual(occurrences, other.occurrences, (Occurrences a, Occurrences b) => a == b);
1374 } 1406 }
1375 return false; 1407 return false;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1433 new ResponseDecoder(), "params", notification.params); 1465 new ResponseDecoder(), "params", notification.params);
1434 } 1466 }
1435 1467
1436 Map<String, dynamic> toJson() { 1468 Map<String, dynamic> toJson() {
1437 Map<String, dynamic> result = {}; 1469 Map<String, dynamic> result = {};
1438 result["file"] = file; 1470 result["file"] = file;
1439 result["outline"] = outline.toJson(); 1471 result["outline"] = outline.toJson();
1440 return result; 1472 return result;
1441 } 1473 }
1442 1474
1475 Notification toNotification() {
1476 return new Notification("analysis.outline", toJson());
1477 }
1478
1443 @override 1479 @override
1444 String toString() => JSON.encode(toJson()); 1480 String toString() => JSON.encode(toJson());
1445 1481
1446 @override 1482 @override
1447 bool operator==(other) { 1483 bool operator==(other) {
1448 if (other is AnalysisOutlineParams) { 1484 if (other is AnalysisOutlineParams) {
1449 return file == other.file && 1485 return file == other.file &&
1450 outline == other.outline; 1486 outline == other.outline;
1451 } 1487 }
1452 return false; 1488 return false;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1510 new ResponseDecoder(), "params", notification.params); 1546 new ResponseDecoder(), "params", notification.params);
1511 } 1547 }
1512 1548
1513 Map<String, dynamic> toJson() { 1549 Map<String, dynamic> toJson() {
1514 Map<String, dynamic> result = {}; 1550 Map<String, dynamic> result = {};
1515 result["file"] = file; 1551 result["file"] = file;
1516 result["overrides"] = overrides.map((Override value) => value.toJson()).toLi st(); 1552 result["overrides"] = overrides.map((Override value) => value.toJson()).toLi st();
1517 return result; 1553 return result;
1518 } 1554 }
1519 1555
1556 Notification toNotification() {
1557 return new Notification("analysis.overrides", toJson());
1558 }
1559
1520 @override 1560 @override
1521 String toString() => JSON.encode(toJson()); 1561 String toString() => JSON.encode(toJson());
1522 1562
1523 @override 1563 @override
1524 bool operator==(other) { 1564 bool operator==(other) {
1525 if (other is AnalysisOverridesParams) { 1565 if (other is AnalysisOverridesParams) {
1526 return file == other.file && 1566 return file == other.file &&
1527 _listEqual(overrides, other.overrides, (Override a, Override b) => a = = b); 1567 _listEqual(overrides, other.overrides, (Override a, Override b) => a = = b);
1528 } 1568 }
1529 return false; 1569 return false;
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
1783 Map<String, dynamic> toJson() { 1823 Map<String, dynamic> toJson() {
1784 Map<String, dynamic> result = {}; 1824 Map<String, dynamic> result = {};
1785 result["id"] = id; 1825 result["id"] = id;
1786 result["replacementOffset"] = replacementOffset; 1826 result["replacementOffset"] = replacementOffset;
1787 result["replacementLength"] = replacementLength; 1827 result["replacementLength"] = replacementLength;
1788 result["results"] = results.map((CompletionSuggestion value) => value.toJson ()).toList(); 1828 result["results"] = results.map((CompletionSuggestion value) => value.toJson ()).toList();
1789 result["last"] = last; 1829 result["last"] = last;
1790 return result; 1830 return result;
1791 } 1831 }
1792 1832
1833 Notification toNotification() {
1834 return new Notification("completion.results", toJson());
1835 }
1836
1793 @override 1837 @override
1794 String toString() => JSON.encode(toJson()); 1838 String toString() => JSON.encode(toJson());
1795 1839
1796 @override 1840 @override
1797 bool operator==(other) { 1841 bool operator==(other) {
1798 if (other is CompletionResultsParams) { 1842 if (other is CompletionResultsParams) {
1799 return id == other.id && 1843 return id == other.id &&
1800 replacementOffset == other.replacementOffset && 1844 replacementOffset == other.replacementOffset &&
1801 replacementLength == other.replacementLength && 1845 replacementLength == other.replacementLength &&
1802 _listEqual(results, other.results, (CompletionSuggestion a, Completion Suggestion b) => a == b) && 1846 _listEqual(results, other.results, (CompletionSuggestion a, Completion Suggestion b) => a == b) &&
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after
2621 } 2665 }
2622 2666
2623 Map<String, dynamic> toJson() { 2667 Map<String, dynamic> toJson() {
2624 Map<String, dynamic> result = {}; 2668 Map<String, dynamic> result = {};
2625 result["id"] = id; 2669 result["id"] = id;
2626 result["results"] = results.map((SearchResult value) => value.toJson()).toLi st(); 2670 result["results"] = results.map((SearchResult value) => value.toJson()).toLi st();
2627 result["last"] = last; 2671 result["last"] = last;
2628 return result; 2672 return result;
2629 } 2673 }
2630 2674
2675 Notification toNotification() {
2676 return new Notification("search.results", toJson());
2677 }
2678
2631 @override 2679 @override
2632 String toString() => JSON.encode(toJson()); 2680 String toString() => JSON.encode(toJson());
2633 2681
2634 @override 2682 @override
2635 bool operator==(other) { 2683 bool operator==(other) {
2636 if (other is SearchResultsParams) { 2684 if (other is SearchResultsParams) {
2637 return id == other.id && 2685 return id == other.id &&
2638 _listEqual(results, other.results, (SearchResult a, SearchResult b) => a == b) && 2686 _listEqual(results, other.results, (SearchResult a, SearchResult b) => a == b) &&
2639 last == other.last; 2687 last == other.last;
2640 } 2688 }
(...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after
3910 } 3958 }
3911 3959
3912 Map<String, dynamic> toJson() { 3960 Map<String, dynamic> toJson() {
3913 Map<String, dynamic> result = {}; 3961 Map<String, dynamic> result = {};
3914 result["executables"] = executables.map((ExecutableFile value) => value.toJs on()).toList(); 3962 result["executables"] = executables.map((ExecutableFile value) => value.toJs on()).toList();
3915 result["dartToHtml"] = dartToHtml; 3963 result["dartToHtml"] = dartToHtml;
3916 result["htmlToDart"] = htmlToDart; 3964 result["htmlToDart"] = htmlToDart;
3917 return result; 3965 return result;
3918 } 3966 }
3919 3967
3968 Notification toNotification() {
3969 return new Notification("debug.launchData", toJson());
3970 }
3971
3920 @override 3972 @override
3921 String toString() => JSON.encode(toJson()); 3973 String toString() => JSON.encode(toJson());
3922 3974
3923 @override 3975 @override
3924 bool operator==(other) { 3976 bool operator==(other) {
3925 if (other is DebugLaunchDataParams) { 3977 if (other is DebugLaunchDataParams) {
3926 return _listEqual(executables, other.executables, (ExecutableFile a, Execu tableFile b) => a == b) && 3978 return _listEqual(executables, other.executables, (ExecutableFile a, Execu tableFile b) => a == b) &&
3927 _mapEqual(dartToHtml, other.dartToHtml, (List<String> a, List<String> b) => _listEqual(a, b, (String a, String b) => a == b)) && 3979 _mapEqual(dartToHtml, other.dartToHtml, (List<String> a, List<String> b) => _listEqual(a, b, (String a, String b) => a == b)) &&
3928 _mapEqual(htmlToDart, other.htmlToDart, (List<String> a, List<String> b) => _listEqual(a, b, (String a, String b) => a == b)); 3980 _mapEqual(htmlToDart, other.htmlToDart, (List<String> a, List<String> b) => _listEqual(a, b, (String a, String b) => a == b));
3929 } 3981 }
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
4009 * { 4061 * {
4010 * "severity": ErrorSeverity 4062 * "severity": ErrorSeverity
4011 * "type": ErrorType 4063 * "type": ErrorType
4012 * "location": Location 4064 * "location": Location
4013 * "message": String 4065 * "message": String
4014 * "correction": optional String 4066 * "correction": optional String
4015 * } 4067 * }
4016 */ 4068 */
4017 class AnalysisError implements HasToJson { 4069 class AnalysisError implements HasToJson {
4018 /** 4070 /**
4071 * Returns a list of AnalysisErrors correponding to the given list of Engine
4072 * errors.
4073 */
4074 static List<AnalysisError> listFromEngine(engine.LineInfo lineInfo, List<engin e.AnalysisError> errors) =>
4075 _analysisErrorListFromEngine(lineInfo, errors);
4076
4077 /**
4019 * The severity of the error. 4078 * The severity of the error.
4020 */ 4079 */
4021 ErrorSeverity severity; 4080 ErrorSeverity severity;
4022 4081
4023 /** 4082 /**
4024 * The type of the error. 4083 * The type of the error.
4025 */ 4084 */
4026 ErrorType type; 4085 ErrorType type;
4027 4086
4028 /** 4087 /**
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after
4946 if (json is String) { 5005 if (json is String) {
4947 try { 5006 try {
4948 return new CompletionSuggestionKind(json); 5007 return new CompletionSuggestionKind(json);
4949 } catch(_) { 5008 } catch(_) {
4950 // Fall through 5009 // Fall through
4951 } 5010 }
4952 } 5011 }
4953 throw jsonDecoder.mismatch(jsonPath, "CompletionSuggestionKind"); 5012 throw jsonDecoder.mismatch(jsonPath, "CompletionSuggestionKind");
4954 } 5013 }
4955 5014
5015 /**
5016 * Construct from an analyzer engine element kind.
5017 */
5018 factory CompletionSuggestionKind.fromElementKind(engine.ElementKind kind) =>
5019 _completionSuggestionKindFromElementKind(kind);
5020
4956 @override 5021 @override
4957 String toString() => "CompletionSuggestionKind.$name"; 5022 String toString() => "CompletionSuggestionKind.$name";
4958 5023
4959 String toJson() => name; 5024 String toJson() => name;
4960 } 5025 }
4961 5026
4962 /** 5027 /**
4963 * DebugService 5028 * DebugService
4964 * 5029 *
4965 * enum { 5030 * enum {
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
5404 /** 5469 /**
5405 * The error with which the fixes are associated. 5470 * The error with which the fixes are associated.
5406 */ 5471 */
5407 AnalysisError error; 5472 AnalysisError error;
5408 5473
5409 /** 5474 /**
5410 * The fixes associated with the error. 5475 * The fixes associated with the error.
5411 */ 5476 */
5412 List<SourceChange> fixes; 5477 List<SourceChange> fixes;
5413 5478
5414 ErrorFixes(this.error, this.fixes); 5479 ErrorFixes(this.error, {this.fixes}) {
5480 if (fixes == null) {
5481 fixes = <SourceChange>[];
5482 }
5483 }
5415 5484
5416 factory ErrorFixes.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object j son) { 5485 factory ErrorFixes.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object j son) {
5417 if (json == null) { 5486 if (json == null) {
5418 json = {}; 5487 json = {};
5419 } 5488 }
5420 if (json is Map) { 5489 if (json is Map) {
5421 AnalysisError error; 5490 AnalysisError error;
5422 if (json.containsKey("error")) { 5491 if (json.containsKey("error")) {
5423 error = new AnalysisError.fromJson(jsonDecoder, jsonPath + ".error", jso n["error"]); 5492 error = new AnalysisError.fromJson(jsonDecoder, jsonPath + ".error", jso n["error"]);
5424 } else { 5493 } else {
5425 throw jsonDecoder.missingKey(jsonPath, "error"); 5494 throw jsonDecoder.missingKey(jsonPath, "error");
5426 } 5495 }
5427 List<SourceChange> fixes; 5496 List<SourceChange> fixes;
5428 if (json.containsKey("fixes")) { 5497 if (json.containsKey("fixes")) {
5429 fixes = jsonDecoder._decodeList(jsonPath + ".fixes", json["fixes"], (Str ing jsonPath, Object json) => new SourceChange.fromJson(jsonDecoder, jsonPath, j son)); 5498 fixes = jsonDecoder._decodeList(jsonPath + ".fixes", json["fixes"], (Str ing jsonPath, Object json) => new SourceChange.fromJson(jsonDecoder, jsonPath, j son));
5430 } else { 5499 } else {
5431 throw jsonDecoder.missingKey(jsonPath, "fixes"); 5500 throw jsonDecoder.missingKey(jsonPath, "fixes");
5432 } 5501 }
5433 return new ErrorFixes(error, fixes); 5502 return new ErrorFixes(error, fixes: fixes);
5434 } else { 5503 } else {
5435 throw jsonDecoder.mismatch(jsonPath, "ErrorFixes"); 5504 throw jsonDecoder.mismatch(jsonPath, "ErrorFixes");
5436 } 5505 }
5437 } 5506 }
5438 5507
5439 Map<String, dynamic> toJson() { 5508 Map<String, dynamic> toJson() {
5440 Map<String, dynamic> result = {}; 5509 Map<String, dynamic> result = {};
5441 result["error"] = error.toJson(); 5510 result["error"] = error.toJson();
5442 result["fixes"] = fixes.map((SourceChange value) => value.toJson()).toList() ; 5511 result["fixes"] = fixes.map((SourceChange value) => value.toJson()).toList() ;
5443 return result; 5512 return result;
5444 } 5513 }
5445 5514
5515 /**
5516 * Add a [Fix]
5517 */
5518 void addFix(Fix fix) {
5519 fixes.add(fix.change);
5520 }
5521
5446 @override 5522 @override
5447 String toString() => JSON.encode(toJson()); 5523 String toString() => JSON.encode(toJson());
5448 5524
5449 @override 5525 @override
5450 bool operator==(other) { 5526 bool operator==(other) {
5451 if (other is ErrorFixes) { 5527 if (other is ErrorFixes) {
5452 return error == other.error && 5528 return error == other.error &&
5453 _listEqual(fixes, other.fixes, (SourceChange a, SourceChange b) => a = = b); 5529 _listEqual(fixes, other.fixes, (SourceChange a, SourceChange b) => a = = b);
5454 } 5530 }
5455 return false; 5531 return false;
(...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after
6398 suggestions = jsonDecoder._decodeList(jsonPath + ".suggestions", json["s uggestions"], (String jsonPath, Object json) => new LinkedEditSuggestion.fromJso n(jsonDecoder, jsonPath, json)); 6474 suggestions = jsonDecoder._decodeList(jsonPath + ".suggestions", json["s uggestions"], (String jsonPath, Object json) => new LinkedEditSuggestion.fromJso n(jsonDecoder, jsonPath, json));
6399 } else { 6475 } else {
6400 throw jsonDecoder.missingKey(jsonPath, "suggestions"); 6476 throw jsonDecoder.missingKey(jsonPath, "suggestions");
6401 } 6477 }
6402 return new LinkedEditGroup(positions, length, suggestions); 6478 return new LinkedEditGroup(positions, length, suggestions);
6403 } else { 6479 } else {
6404 throw jsonDecoder.mismatch(jsonPath, "LinkedEditGroup"); 6480 throw jsonDecoder.mismatch(jsonPath, "LinkedEditGroup");
6405 } 6481 }
6406 } 6482 }
6407 6483
6484 /**
6485 * Construct an empty LinkedEditGroup.
6486 */
6487 LinkedEditGroup.empty() : this(<Position>[], 0, <LinkedEditSuggestion>[]);
6488
6408 Map<String, dynamic> toJson() { 6489 Map<String, dynamic> toJson() {
6409 Map<String, dynamic> result = {}; 6490 Map<String, dynamic> result = {};
6410 result["positions"] = positions.map((Position value) => value.toJson()).toLi st(); 6491 result["positions"] = positions.map((Position value) => value.toJson()).toLi st();
6411 result["length"] = length; 6492 result["length"] = length;
6412 result["suggestions"] = suggestions.map((LinkedEditSuggestion value) => valu e.toJson()).toList(); 6493 result["suggestions"] = suggestions.map((LinkedEditSuggestion value) => valu e.toJson()).toList();
6413 return result; 6494 return result;
6414 } 6495 }
6415 6496
6497 /**
6498 * Add a new position and change the length.
6499 */
6500 void addPosition(Position position, int length) {
6501 positions.add(position);
6502 this.length = length;
6503 }
6504
6505 /**
6506 * Add a new suggestion.
6507 */
6508 void addSuggestion(LinkedEditSuggestion suggestion) {
6509 suggestions.add(suggestion);
6510 }
6511
6416 @override 6512 @override
6417 String toString() => JSON.encode(toJson()); 6513 String toString() => JSON.encode(toJson());
6418 6514
6419 @override 6515 @override
6420 bool operator==(other) { 6516 bool operator==(other) {
6421 if (other is LinkedEditGroup) { 6517 if (other is LinkedEditGroup) {
6422 return _listEqual(positions, other.positions, (Position a, Position b) => a == b) && 6518 return _listEqual(positions, other.positions, (Position a, Position b) => a == b) &&
6423 length == other.length && 6519 length == other.length &&
6424 _listEqual(suggestions, other.suggestions, (LinkedEditSuggestion a, Li nkedEditSuggestion b) => a == b); 6520 _listEqual(suggestions, other.suggestions, (LinkedEditSuggestion a, Li nkedEditSuggestion b) => a == b);
6425 } 6521 }
(...skipping 1539 matching lines...) Expand 10 before | Expand all | Expand 10 after
7965 * A list of the linked editing groups used to customize the changes that 8061 * A list of the linked editing groups used to customize the changes that
7966 * were made. 8062 * were made.
7967 */ 8063 */
7968 List<LinkedEditGroup> linkedEditGroups; 8064 List<LinkedEditGroup> linkedEditGroups;
7969 8065
7970 /** 8066 /**
7971 * The position that should be selected after the edits have been applied. 8067 * The position that should be selected after the edits have been applied.
7972 */ 8068 */
7973 Position selection; 8069 Position selection;
7974 8070
7975 SourceChange(this.message, this.edits, this.linkedEditGroups, {this.selection} ); 8071 SourceChange(this.message, {this.edits, this.linkedEditGroups, this.selection} ) {
8072 if (edits == null) {
8073 edits = <SourceFileEdit>[];
8074 }
8075 if (linkedEditGroups == null) {
8076 linkedEditGroups = <LinkedEditGroup>[];
8077 }
8078 }
7976 8079
7977 factory SourceChange.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) { 8080 factory SourceChange.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {
7978 if (json == null) { 8081 if (json == null) {
7979 json = {}; 8082 json = {};
7980 } 8083 }
7981 if (json is Map) { 8084 if (json is Map) {
7982 String message; 8085 String message;
7983 if (json.containsKey("message")) { 8086 if (json.containsKey("message")) {
7984 message = jsonDecoder._decodeString(jsonPath + ".message", json["message "]); 8087 message = jsonDecoder._decodeString(jsonPath + ".message", json["message "]);
7985 } else { 8088 } else {
7986 throw jsonDecoder.missingKey(jsonPath, "message"); 8089 throw jsonDecoder.missingKey(jsonPath, "message");
7987 } 8090 }
7988 List<SourceFileEdit> edits; 8091 List<SourceFileEdit> edits;
7989 if (json.containsKey("edits")) { 8092 if (json.containsKey("edits")) {
7990 edits = jsonDecoder._decodeList(jsonPath + ".edits", json["edits"], (Str ing jsonPath, Object json) => new SourceFileEdit.fromJson(jsonDecoder, jsonPath, json)); 8093 edits = jsonDecoder._decodeList(jsonPath + ".edits", json["edits"], (Str ing jsonPath, Object json) => new SourceFileEdit.fromJson(jsonDecoder, jsonPath, json));
7991 } else { 8094 } else {
7992 throw jsonDecoder.missingKey(jsonPath, "edits"); 8095 throw jsonDecoder.missingKey(jsonPath, "edits");
7993 } 8096 }
7994 List<LinkedEditGroup> linkedEditGroups; 8097 List<LinkedEditGroup> linkedEditGroups;
7995 if (json.containsKey("linkedEditGroups")) { 8098 if (json.containsKey("linkedEditGroups")) {
7996 linkedEditGroups = jsonDecoder._decodeList(jsonPath + ".linkedEditGroups ", json["linkedEditGroups"], (String jsonPath, Object json) => new LinkedEditGro up.fromJson(jsonDecoder, jsonPath, json)); 8099 linkedEditGroups = jsonDecoder._decodeList(jsonPath + ".linkedEditGroups ", json["linkedEditGroups"], (String jsonPath, Object json) => new LinkedEditGro up.fromJson(jsonDecoder, jsonPath, json));
7997 } else { 8100 } else {
7998 throw jsonDecoder.missingKey(jsonPath, "linkedEditGroups"); 8101 throw jsonDecoder.missingKey(jsonPath, "linkedEditGroups");
7999 } 8102 }
8000 Position selection; 8103 Position selection;
8001 if (json.containsKey("selection")) { 8104 if (json.containsKey("selection")) {
8002 selection = new Position.fromJson(jsonDecoder, jsonPath + ".selection", json["selection"]); 8105 selection = new Position.fromJson(jsonDecoder, jsonPath + ".selection", json["selection"]);
8003 } 8106 }
8004 return new SourceChange(message, edits, linkedEditGroups, selection: selec tion); 8107 return new SourceChange(message, edits: edits, linkedEditGroups: linkedEdi tGroups, selection: selection);
8005 } else { 8108 } else {
8006 throw jsonDecoder.mismatch(jsonPath, "SourceChange"); 8109 throw jsonDecoder.mismatch(jsonPath, "SourceChange");
8007 } 8110 }
8008 } 8111 }
8009 8112
8010 Map<String, dynamic> toJson() { 8113 Map<String, dynamic> toJson() {
8011 Map<String, dynamic> result = {}; 8114 Map<String, dynamic> result = {};
8012 result["message"] = message; 8115 result["message"] = message;
8013 result["edits"] = edits.map((SourceFileEdit value) => value.toJson()).toList (); 8116 result["edits"] = edits.map((SourceFileEdit value) => value.toJson()).toList ();
8014 result["linkedEditGroups"] = linkedEditGroups.map((LinkedEditGroup value) => value.toJson()).toList(); 8117 result["linkedEditGroups"] = linkedEditGroups.map((LinkedEditGroup value) => value.toJson()).toList();
8015 if (selection != null) { 8118 if (selection != null) {
8016 result["selection"] = selection.toJson(); 8119 result["selection"] = selection.toJson();
8017 } 8120 }
8018 return result; 8121 return result;
8019 } 8122 }
8020 8123
8124 /**
8125 * Adds [edit] to the [FileEdit] for the given [file].
8126 */
8127 void addEdit(String file, SourceEdit edit) =>
8128 _addEditToSourceChange(this, file, edit);
8129
8130 /**
8131 * Adds the given [FileEdit].
8132 */
8133 void addFileEdit(SourceFileEdit edit) {
8134 edits.add(edit);
8135 }
8136
8137 /**
8138 * Adds the given [LinkedEditGroup].
8139 */
8140 void addLinkedEditGroup(LinkedEditGroup linkedEditGroup) {
8141 linkedEditGroups.add(linkedEditGroup);
8142 }
8143
8144 /**
8145 * Returns the [FileEdit] for the given [file], maybe `null`.
8146 */
8147 SourceFileEdit getFileEdit(String file) =>
8148 _getChangeFileEdit(this, file);
8149
8021 @override 8150 @override
8022 String toString() => JSON.encode(toJson()); 8151 String toString() => JSON.encode(toJson());
8023 8152
8024 @override 8153 @override
8025 bool operator==(other) { 8154 bool operator==(other) {
8026 if (other is SourceChange) { 8155 if (other is SourceChange) {
8027 return message == other.message && 8156 return message == other.message &&
8028 _listEqual(edits, other.edits, (SourceFileEdit a, SourceFileEdit b) => a == b) && 8157 _listEqual(edits, other.edits, (SourceFileEdit a, SourceFileEdit b) => a == b) &&
8029 _listEqual(linkedEditGroups, other.linkedEditGroups, (LinkedEditGroup a, LinkedEditGroup b) => a == b) && 8158 _listEqual(linkedEditGroups, other.linkedEditGroups, (LinkedEditGroup a, LinkedEditGroup b) => a == b) &&
8030 selection == other.selection; 8159 selection == other.selection;
(...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after
9138 return false; 9267 return false;
9139 } 9268 }
9140 9269
9141 @override 9270 @override
9142 int get hashCode { 9271 int get hashCode {
9143 int hash = 0; 9272 int hash = 0;
9144 hash = _JenkinsSmiHash.combine(hash, newName.hashCode); 9273 hash = _JenkinsSmiHash.combine(hash, newName.hashCode);
9145 return _JenkinsSmiHash.finish(hash); 9274 return _JenkinsSmiHash.finish(hash);
9146 } 9275 }
9147 } 9276 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/edit/fix.dart ('k') | pkg/analysis_server/lib/src/operation/operation_analysis.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698