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

Side by Side Diff: pkg/analyzer_plugin/lib/protocol/generated_protocol.dart

Issue 2678263005: Add a priority to source changes for assists and fixes (Closed)
Patch Set: Created 3 years, 10 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
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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/tool/spec/generate_files". 7 // "pkg/analysis_server/tool/spec/generate_files".
8 8
9 import 'dart:convert' hide JsonDecoder; 9 import 'dart:convert' hide JsonDecoder;
10 10
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 hash = JenkinsSmiHash.combine(hash, hasFix.hashCode); 334 hash = JenkinsSmiHash.combine(hash, hasFix.hashCode);
335 return JenkinsSmiHash.finish(hash); 335 return JenkinsSmiHash.finish(hash);
336 } 336 }
337 } 337 }
338 338
339 /** 339 /**
340 * AnalysisErrorFixes 340 * AnalysisErrorFixes
341 * 341 *
342 * { 342 * {
343 * "error": AnalysisError 343 * "error": AnalysisError
344 * "fixes": List<SourceChange> 344 * "fixes": List<PrioritizedSourceChange>
345 * } 345 * }
346 * 346 *
347 * Clients may not extend, implement or mix-in this class. 347 * Clients may not extend, implement or mix-in this class.
348 */ 348 */
349 class AnalysisErrorFixes implements HasToJson { 349 class AnalysisErrorFixes implements HasToJson {
350 AnalysisError _error; 350 AnalysisError _error;
351 351
352 List<SourceChange> _fixes; 352 List<PrioritizedSourceChange> _fixes;
353 353
354 /** 354 /**
355 * The error with which the fixes are associated. 355 * The error with which the fixes are associated.
356 */ 356 */
357 AnalysisError get error => _error; 357 AnalysisError get error => _error;
358 358
359 /** 359 /**
360 * The error with which the fixes are associated. 360 * The error with which the fixes are associated.
361 */ 361 */
362 void set error(AnalysisError value) { 362 void set error(AnalysisError value) {
363 assert(value != null); 363 assert(value != null);
364 this._error = value; 364 this._error = value;
365 } 365 }
366 366
367 /** 367 /**
368 * The fixes associated with the error. 368 * The fixes associated with the error.
369 */ 369 */
370 List<SourceChange> get fixes => _fixes; 370 List<PrioritizedSourceChange> get fixes => _fixes;
371 371
372 /** 372 /**
373 * The fixes associated with the error. 373 * The fixes associated with the error.
374 */ 374 */
375 void set fixes(List<SourceChange> value) { 375 void set fixes(List<PrioritizedSourceChange> value) {
376 assert(value != null); 376 assert(value != null);
377 this._fixes = value; 377 this._fixes = value;
378 } 378 }
379 379
380 AnalysisErrorFixes(AnalysisError error, {List<SourceChange> fixes}) { 380 AnalysisErrorFixes(AnalysisError error, {List<PrioritizedSourceChange> fixes}) {
381 this.error = error; 381 this.error = error;
382 if (fixes == null) { 382 if (fixes == null) {
383 this.fixes = <SourceChange>[]; 383 this.fixes = <PrioritizedSourceChange>[];
384 } else { 384 } else {
385 this.fixes = fixes; 385 this.fixes = fixes;
386 } 386 }
387 } 387 }
388 388
389 factory AnalysisErrorFixes.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) { 389 factory AnalysisErrorFixes.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {
390 if (json == null) { 390 if (json == null) {
391 json = {}; 391 json = {};
392 } 392 }
393 if (json is Map) { 393 if (json is Map) {
394 AnalysisError error; 394 AnalysisError error;
395 if (json.containsKey("error")) { 395 if (json.containsKey("error")) {
396 error = new AnalysisError.fromJson(jsonDecoder, jsonPath + ".error", jso n["error"]); 396 error = new AnalysisError.fromJson(jsonDecoder, jsonPath + ".error", jso n["error"]);
397 } else { 397 } else {
398 throw jsonDecoder.mismatch(jsonPath, "error"); 398 throw jsonDecoder.mismatch(jsonPath, "error");
399 } 399 }
400 List<SourceChange> fixes; 400 List<PrioritizedSourceChange> fixes;
401 if (json.containsKey("fixes")) { 401 if (json.containsKey("fixes")) {
402 fixes = jsonDecoder.decodeList(jsonPath + ".fixes", json["fixes"], (Stri ng jsonPath, Object json) => new SourceChange.fromJson(jsonDecoder, jsonPath, js on)); 402 fixes = jsonDecoder.decodeList(jsonPath + ".fixes", json["fixes"], (Stri ng jsonPath, Object json) => new PrioritizedSourceChange.fromJson(jsonDecoder, j sonPath, json));
403 } else { 403 } else {
404 throw jsonDecoder.mismatch(jsonPath, "fixes"); 404 throw jsonDecoder.mismatch(jsonPath, "fixes");
405 } 405 }
406 return new AnalysisErrorFixes(error, fixes: fixes); 406 return new AnalysisErrorFixes(error, fixes: fixes);
407 } else { 407 } else {
408 throw jsonDecoder.mismatch(jsonPath, "AnalysisErrorFixes", json); 408 throw jsonDecoder.mismatch(jsonPath, "AnalysisErrorFixes", json);
409 } 409 }
410 } 410 }
411 411
412 @override 412 @override
413 Map<String, dynamic> toJson() { 413 Map<String, dynamic> toJson() {
414 Map<String, dynamic> result = {}; 414 Map<String, dynamic> result = {};
415 result["error"] = error.toJson(); 415 result["error"] = error.toJson();
416 result["fixes"] = fixes.map((SourceChange value) => value.toJson()).toList() ; 416 result["fixes"] = fixes.map((PrioritizedSourceChange value) => value.toJson( )).toList();
417 return result; 417 return result;
418 } 418 }
419 419
420 @override 420 @override
421 String toString() => JSON.encode(toJson()); 421 String toString() => JSON.encode(toJson());
422 422
423 @override 423 @override
424 bool operator==(other) { 424 bool operator==(other) {
425 if (other is AnalysisErrorFixes) { 425 if (other is AnalysisErrorFixes) {
426 return error == other.error && 426 return error == other.error &&
427 listEqual(fixes, other.fixes, (SourceChange a, SourceChange b) => a == b); 427 listEqual(fixes, other.fixes, (PrioritizedSourceChange a, PrioritizedS ourceChange b) => a == b);
428 } 428 }
429 return false; 429 return false;
430 } 430 }
431 431
432 @override 432 @override
433 int get hashCode { 433 int get hashCode {
434 int hash = 0; 434 int hash = 0;
435 hash = JenkinsSmiHash.combine(hash, error.hashCode); 435 hash = JenkinsSmiHash.combine(hash, error.hashCode);
436 hash = JenkinsSmiHash.combine(hash, fixes.hashCode); 436 hash = JenkinsSmiHash.combine(hash, fixes.hashCode);
437 return JenkinsSmiHash.finish(hash); 437 return JenkinsSmiHash.finish(hash);
(...skipping 3194 matching lines...) Expand 10 before | Expand all | Expand 10 after
3632 hash = JenkinsSmiHash.combine(hash, offset.hashCode); 3632 hash = JenkinsSmiHash.combine(hash, offset.hashCode);
3633 hash = JenkinsSmiHash.combine(hash, length.hashCode); 3633 hash = JenkinsSmiHash.combine(hash, length.hashCode);
3634 return JenkinsSmiHash.finish(hash); 3634 return JenkinsSmiHash.finish(hash);
3635 } 3635 }
3636 } 3636 }
3637 3637
3638 /** 3638 /**
3639 * edit.getAssists result 3639 * edit.getAssists result
3640 * 3640 *
3641 * { 3641 * {
3642 * "assists": List<SourceChange> 3642 * "assists": List<PrioritizedSourceChange>
3643 * } 3643 * }
3644 * 3644 *
3645 * Clients may not extend, implement or mix-in this class. 3645 * Clients may not extend, implement or mix-in this class.
3646 */ 3646 */
3647 class EditGetAssistsResult implements ResponseResult { 3647 class EditGetAssistsResult implements ResponseResult {
3648 List<SourceChange> _assists; 3648 List<PrioritizedSourceChange> _assists;
3649 3649
3650 /** 3650 /**
3651 * The assists that are available at the given location. 3651 * The assists that are available at the given location.
3652 */ 3652 */
3653 List<SourceChange> get assists => _assists; 3653 List<PrioritizedSourceChange> get assists => _assists;
3654 3654
3655 /** 3655 /**
3656 * The assists that are available at the given location. 3656 * The assists that are available at the given location.
3657 */ 3657 */
3658 void set assists(List<SourceChange> value) { 3658 void set assists(List<PrioritizedSourceChange> value) {
3659 assert(value != null); 3659 assert(value != null);
3660 this._assists = value; 3660 this._assists = value;
3661 } 3661 }
3662 3662
3663 EditGetAssistsResult(List<SourceChange> assists) { 3663 EditGetAssistsResult(List<PrioritizedSourceChange> assists) {
3664 this.assists = assists; 3664 this.assists = assists;
3665 } 3665 }
3666 3666
3667 factory EditGetAssistsResult.fromJson(JsonDecoder jsonDecoder, String jsonPath , Object json) { 3667 factory EditGetAssistsResult.fromJson(JsonDecoder jsonDecoder, String jsonPath , Object json) {
3668 if (json == null) { 3668 if (json == null) {
3669 json = {}; 3669 json = {};
3670 } 3670 }
3671 if (json is Map) { 3671 if (json is Map) {
3672 List<SourceChange> assists; 3672 List<PrioritizedSourceChange> assists;
3673 if (json.containsKey("assists")) { 3673 if (json.containsKey("assists")) {
3674 assists = jsonDecoder.decodeList(jsonPath + ".assists", json["assists"], (String jsonPath, Object json) => new SourceChange.fromJson(jsonDecoder, jsonPa th, json)); 3674 assists = jsonDecoder.decodeList(jsonPath + ".assists", json["assists"], (String jsonPath, Object json) => new PrioritizedSourceChange.fromJson(jsonDeco der, jsonPath, json));
3675 } else { 3675 } else {
3676 throw jsonDecoder.mismatch(jsonPath, "assists"); 3676 throw jsonDecoder.mismatch(jsonPath, "assists");
3677 } 3677 }
3678 return new EditGetAssistsResult(assists); 3678 return new EditGetAssistsResult(assists);
3679 } else { 3679 } else {
3680 throw jsonDecoder.mismatch(jsonPath, "edit.getAssists result", json); 3680 throw jsonDecoder.mismatch(jsonPath, "edit.getAssists result", json);
3681 } 3681 }
3682 } 3682 }
3683 3683
3684 factory EditGetAssistsResult.fromResponse(Response response) { 3684 factory EditGetAssistsResult.fromResponse(Response response) {
3685 return new EditGetAssistsResult.fromJson( 3685 return new EditGetAssistsResult.fromJson(
3686 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)), " result", response.result); 3686 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)), " result", response.result);
3687 } 3687 }
3688 3688
3689 @override 3689 @override
3690 Map<String, dynamic> toJson() { 3690 Map<String, dynamic> toJson() {
3691 Map<String, dynamic> result = {}; 3691 Map<String, dynamic> result = {};
3692 result["assists"] = assists.map((SourceChange value) => value.toJson()).toLi st(); 3692 result["assists"] = assists.map((PrioritizedSourceChange value) => value.toJ son()).toList();
3693 return result; 3693 return result;
3694 } 3694 }
3695 3695
3696 @override 3696 @override
3697 Response toResponse(String id) { 3697 Response toResponse(String id) {
3698 return new Response(id, result: toJson()); 3698 return new Response(id, result: toJson());
3699 } 3699 }
3700 3700
3701 @override 3701 @override
3702 String toString() => JSON.encode(toJson()); 3702 String toString() => JSON.encode(toJson());
3703 3703
3704 @override 3704 @override
3705 bool operator==(other) { 3705 bool operator==(other) {
3706 if (other is EditGetAssistsResult) { 3706 if (other is EditGetAssistsResult) {
3707 return listEqual(assists, other.assists, (SourceChange a, SourceChange b) => a == b); 3707 return listEqual(assists, other.assists, (PrioritizedSourceChange a, Prior itizedSourceChange b) => a == b);
3708 } 3708 }
3709 return false; 3709 return false;
3710 } 3710 }
3711 3711
3712 @override 3712 @override
3713 int get hashCode { 3713 int get hashCode {
3714 int hash = 0; 3714 int hash = 0;
3715 hash = JenkinsSmiHash.combine(hash, assists.hashCode); 3715 hash = JenkinsSmiHash.combine(hash, assists.hashCode);
3716 return JenkinsSmiHash.finish(hash); 3716 return JenkinsSmiHash.finish(hash);
3717 } 3717 }
(...skipping 5090 matching lines...) Expand 10 before | Expand all | Expand 10 after
8808 @override 8808 @override
8809 int get hashCode { 8809 int get hashCode {
8810 int hash = 0; 8810 int hash = 0;
8811 hash = JenkinsSmiHash.combine(hash, file.hashCode); 8811 hash = JenkinsSmiHash.combine(hash, file.hashCode);
8812 hash = JenkinsSmiHash.combine(hash, offset.hashCode); 8812 hash = JenkinsSmiHash.combine(hash, offset.hashCode);
8813 return JenkinsSmiHash.finish(hash); 8813 return JenkinsSmiHash.finish(hash);
8814 } 8814 }
8815 } 8815 }
8816 8816
8817 /** 8817 /**
8818 * PrioritizedSourceChange
8819 *
8820 * {
8821 * "priority": int
8822 * "change": SourceChange
8823 * }
8824 *
8825 * Clients may not extend, implement or mix-in this class.
8826 */
8827 class PrioritizedSourceChange implements HasToJson {
8828 int _priority;
8829
8830 SourceChange _change;
8831
8832 /**
8833 * The priority of the change. The value is expected to be non-negative, and
8834 * zero (0) is the lowest priority.
8835 */
8836 int get priority => _priority;
8837
8838 /**
8839 * The priority of the change. The value is expected to be non-negative, and
8840 * zero (0) is the lowest priority.
8841 */
8842 void set priority(int value) {
8843 assert(value != null);
8844 this._priority = value;
8845 }
8846
8847 /**
8848 * The change with which the relevance is associated.
8849 */
8850 SourceChange get change => _change;
8851
8852 /**
8853 * The change with which the relevance is associated.
8854 */
8855 void set change(SourceChange value) {
8856 assert(value != null);
8857 this._change = value;
8858 }
8859
8860 PrioritizedSourceChange(int priority, SourceChange change) {
8861 this.priority = priority;
8862 this.change = change;
8863 }
8864
8865 factory PrioritizedSourceChange.fromJson(JsonDecoder jsonDecoder, String jsonP ath, Object json) {
8866 if (json == null) {
8867 json = {};
8868 }
8869 if (json is Map) {
8870 int priority;
8871 if (json.containsKey("priority")) {
8872 priority = jsonDecoder.decodeInt(jsonPath + ".priority", json["priority" ]);
8873 } else {
8874 throw jsonDecoder.mismatch(jsonPath, "priority");
8875 }
8876 SourceChange change;
8877 if (json.containsKey("change")) {
8878 change = new SourceChange.fromJson(jsonDecoder, jsonPath + ".change", js on["change"]);
8879 } else {
8880 throw jsonDecoder.mismatch(jsonPath, "change");
8881 }
8882 return new PrioritizedSourceChange(priority, change);
8883 } else {
8884 throw jsonDecoder.mismatch(jsonPath, "PrioritizedSourceChange", json);
8885 }
8886 }
8887
8888 @override
8889 Map<String, dynamic> toJson() {
8890 Map<String, dynamic> result = {};
8891 result["priority"] = priority;
8892 result["change"] = change.toJson();
8893 return result;
8894 }
8895
8896 @override
8897 String toString() => JSON.encode(toJson());
8898
8899 @override
8900 bool operator==(other) {
8901 if (other is PrioritizedSourceChange) {
8902 return priority == other.priority &&
8903 change == other.change;
8904 }
8905 return false;
8906 }
8907
8908 @override
8909 int get hashCode {
8910 int hash = 0;
8911 hash = JenkinsSmiHash.combine(hash, priority.hashCode);
8912 hash = JenkinsSmiHash.combine(hash, change.hashCode);
8913 return JenkinsSmiHash.finish(hash);
8914 }
8915 }
8916
8917 /**
8818 * RefactoringFeedback 8918 * RefactoringFeedback
8819 * 8919 *
8820 * { 8920 * {
8821 * } 8921 * }
8822 * 8922 *
8823 * Clients may not extend, implement or mix-in this class. 8923 * Clients may not extend, implement or mix-in this class.
8824 */ 8924 */
8825 class RefactoringFeedback implements HasToJson { 8925 class RefactoringFeedback implements HasToJson {
8826 RefactoringFeedback(); 8926 RefactoringFeedback();
8827 8927
(...skipping 1767 matching lines...) Expand 10 before | Expand all | Expand 10 after
10595 } 10695 }
10596 } 10696 }
10597 throw jsonDecoder.mismatch(jsonPath, "WatchEventType", json); 10697 throw jsonDecoder.mismatch(jsonPath, "WatchEventType", json);
10598 } 10698 }
10599 10699
10600 @override 10700 @override
10601 String toString() => "WatchEventType.$name"; 10701 String toString() => "WatchEventType.$name";
10602 10702
10603 String toJson() => name; 10703 String toJson() => name;
10604 } 10704 }
OLDNEW
« no previous file with comments | « pkg/analyzer_plugin/lib/plugin/plugin.dart ('k') | pkg/analyzer_plugin/test/integration/support/integration_test_methods.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698