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

Unified 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, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/lib/src/generated_protocol.dart
diff --git a/pkg/analysis_server/lib/src/generated_protocol.dart b/pkg/analysis_server/lib/src/generated_protocol.dart
index 6314527bca4037d80f03eb38218576e5c20f1577..27be4cfc7f14ef2fdb9bf0c966a984fb9adbb919 100644
--- a/pkg/analysis_server/lib/src/generated_protocol.dart
+++ b/pkg/analysis_server/lib/src/generated_protocol.dart
@@ -211,6 +211,10 @@ class ServerErrorParams implements HasToJson {
return result;
}
+ Notification toNotification() {
+ return new Notification("server.error", toJson());
+ }
+
@override
String toString() => JSON.encode(toJson());
@@ -278,6 +282,10 @@ class ServerStatusParams implements HasToJson {
return result;
}
+ Notification toNotification() {
+ return new Notification("server.status", toJson());
+ }
+
@override
String toString() => JSON.encode(toJson());
@@ -984,6 +992,10 @@ class AnalysisErrorsParams implements HasToJson {
return result;
}
+ Notification toNotification() {
+ return new Notification("analysis.errors", toJson());
+ }
+
@override
String toString() => JSON.encode(toJson());
@@ -1048,6 +1060,10 @@ class AnalysisFlushResultsParams implements HasToJson {
return result;
}
+ Notification toNotification() {
+ return new Notification("analysis.flushResults", toJson());
+ }
+
@override
String toString() => JSON.encode(toJson());
@@ -1123,6 +1139,10 @@ class AnalysisFoldingParams implements HasToJson {
return result;
}
+ Notification toNotification() {
+ return new Notification("analysis.folding", toJson());
+ }
+
@override
String toString() => JSON.encode(toJson());
@@ -1204,6 +1224,10 @@ class AnalysisHighlightsParams implements HasToJson {
return result;
}
+ Notification toNotification() {
+ return new Notification("analysis.highlights", toJson());
+ }
+
@override
String toString() => JSON.encode(toJson());
@@ -1286,6 +1310,10 @@ class AnalysisNavigationParams implements HasToJson {
return result;
}
+ Notification toNotification() {
+ return new Notification("analysis.navigation", toJson());
+ }
+
@override
String toString() => JSON.encode(toJson());
@@ -1363,6 +1391,10 @@ class AnalysisOccurrencesParams implements HasToJson {
return result;
}
+ Notification toNotification() {
+ return new Notification("analysis.occurrences", toJson());
+ }
+
@override
String toString() => JSON.encode(toJson());
@@ -1440,6 +1472,10 @@ class AnalysisOutlineParams implements HasToJson {
return result;
}
+ Notification toNotification() {
+ return new Notification("analysis.outline", toJson());
+ }
+
@override
String toString() => JSON.encode(toJson());
@@ -1517,6 +1553,10 @@ class AnalysisOverridesParams implements HasToJson {
return result;
}
+ Notification toNotification() {
+ return new Notification("analysis.overrides", toJson());
+ }
+
@override
String toString() => JSON.encode(toJson());
@@ -1790,6 +1830,10 @@ class CompletionResultsParams implements HasToJson {
return result;
}
+ Notification toNotification() {
+ return new Notification("completion.results", toJson());
+ }
+
@override
String toString() => JSON.encode(toJson());
@@ -2628,6 +2672,10 @@ class SearchResultsParams implements HasToJson {
return result;
}
+ Notification toNotification() {
+ return new Notification("search.results", toJson());
+ }
+
@override
String toString() => JSON.encode(toJson());
@@ -3917,6 +3965,10 @@ class DebugLaunchDataParams implements HasToJson {
return result;
}
+ Notification toNotification() {
+ return new Notification("debug.launchData", toJson());
+ }
+
@override
String toString() => JSON.encode(toJson());
@@ -4016,6 +4068,13 @@ class AddContentOverlay implements HasToJson {
*/
class AnalysisError implements HasToJson {
/**
+ * Returns a list of AnalysisErrors correponding to the given list of Engine
+ * errors.
+ */
+ static List<AnalysisError> listFromEngine(engine.LineInfo lineInfo, List<engine.AnalysisError> errors) =>
+ _analysisErrorListFromEngine(lineInfo, errors);
+
+ /**
* The severity of the error.
*/
ErrorSeverity severity;
@@ -4953,6 +5012,12 @@ class CompletionSuggestionKind {
throw jsonDecoder.mismatch(jsonPath, "CompletionSuggestionKind");
}
+ /**
+ * Construct from an analyzer engine element kind.
+ */
+ factory CompletionSuggestionKind.fromElementKind(engine.ElementKind kind) =>
+ _completionSuggestionKindFromElementKind(kind);
+
@override
String toString() => "CompletionSuggestionKind.$name";
@@ -5411,7 +5476,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) {
@@ -5430,7 +5499,7 @@ class ErrorFixes implements HasToJson {
} else {
throw jsonDecoder.missingKey(jsonPath, "fixes");
}
- return new ErrorFixes(error, fixes);
+ return new ErrorFixes(error, fixes: fixes);
} else {
throw jsonDecoder.mismatch(jsonPath, "ErrorFixes");
}
@@ -5443,6 +5512,13 @@ class ErrorFixes implements HasToJson {
return result;
}
+ /**
+ * Add a [Fix]
+ */
+ void addFix(Fix fix) {
+ fixes.add(fix.change);
+ }
+
@override
String toString() => JSON.encode(toJson());
@@ -6405,6 +6481,11 @@ class LinkedEditGroup implements HasToJson {
}
}
+ /**
+ * Construct an empty LinkedEditGroup.
+ */
+ LinkedEditGroup.empty() : this(<Position>[], 0, <LinkedEditSuggestion>[]);
+
Map<String, dynamic> toJson() {
Map<String, dynamic> result = {};
result["positions"] = positions.map((Position value) => value.toJson()).toList();
@@ -6413,6 +6494,21 @@ class LinkedEditGroup implements HasToJson {
return result;
}
+ /**
+ * Add a new position and change the length.
+ */
+ void addPosition(Position position, int length) {
+ positions.add(position);
+ this.length = length;
+ }
+
+ /**
+ * Add a new suggestion.
+ */
+ void addSuggestion(LinkedEditSuggestion suggestion) {
+ suggestions.add(suggestion);
+ }
+
@override
String toString() => JSON.encode(toJson());
@@ -7972,7 +8068,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) {
@@ -8001,7 +8104,7 @@ class SourceChange implements HasToJson {
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");
}
@@ -8018,6 +8121,32 @@ class SourceChange implements HasToJson {
return result;
}
+ /**
+ * Adds [edit] to the [FileEdit] for the given [file].
+ */
+ void addEdit(String file, SourceEdit edit) =>
+ _addEditToSourceChange(this, file, edit);
+
+ /**
+ * Adds the given [FileEdit].
+ */
+ void addFileEdit(SourceFileEdit edit) {
+ edits.add(edit);
+ }
+
+ /**
+ * Adds the given [LinkedEditGroup].
+ */
+ void addLinkedEditGroup(LinkedEditGroup linkedEditGroup) {
+ linkedEditGroups.add(linkedEditGroup);
+ }
+
+ /**
+ * Returns the [FileEdit] for the given [file], maybe `null`.
+ */
+ SourceFileEdit getFileEdit(String file) =>
+ _getChangeFileEdit(this, file);
+
@override
String toString() => JSON.encode(toJson());
« 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