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

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

Issue 486003003: Start using code-generated protocol classes 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/protocol.dart
diff --git a/pkg/analysis_server/lib/src/protocol.dart b/pkg/analysis_server/lib/src/protocol.dart
index 29b89dcc58820075906e87dcc9d825dbf7d6b621..c82023936f7c1ebfbff836d7575a5d1e9e0437ba 100644
--- a/pkg/analysis_server/lib/src/protocol.dart
+++ b/pkg/analysis_server/lib/src/protocol.dart
@@ -10,45 +10,6 @@ import 'dart:convert' show JsonDecoder;
import 'package:analysis_server/src/services/json.dart';
/**
- * An abstract enumeration.
- */
-abstract class Enum2<E extends Enum2> implements Comparable<E> {
- /**
- * The name of this enum constant, as declared in the enum declaration.
- */
- final String name;
-
- /**
- * The position in the enum declaration.
- */
- final int ordinal;
-
- const Enum2(this.name, this.ordinal);
-
- @override
- int get hashCode => ordinal;
-
- @override
- String toString() => name;
-
- int compareTo(E other) => ordinal - other.ordinal;
-
- /**
- * Returns the enum constant with the given [name], `null` if not found.
- */
- static Enum2 valueOf(List<Enum2> values, String name) {
- for (int i = 0; i < values.length; i++) {
- Enum2 value = values[i];
- if (value.name == name) {
- return value;
- }
- }
- return null;
- }
-}
-
-
-/**
* Instances of the class [Request] represent a request that was received.
*/
class Request {
@@ -136,17 +97,6 @@ class Request {
}
/**
- * Return the value of the parameter with the given [name], or [defaultValue]
- * if there is no such parameter associated with this request.
- */
- RequestDatum getParameter(String name, defaultValue) {
- if (!params.containsKey(name)) {
- return new RequestDatum(this, "default for $name", defaultValue);
- }
- return new RequestDatum(this, name, params[name]);
- }
-
- /**
* Return the value of the parameter with the given [name], or throw a
* [RequestFailure] exception with an appropriate error message if there is no
* such parameter associated with this request.
@@ -355,22 +305,6 @@ class RequestDatum {
}
/**
- * Validate that the datum is a list of strings, and convert it into [Enum]s.
- */
- Set<Enum2> asEnumSet(List<Enum2> allValues) {
- Set values = new Set();
- for (String name in asStringList()) {
- Enum2 value = Enum2.valueOf(allValues, name);
- if (value == null) {
- throw new RequestFailure(new Response.invalidParameter(request, path,
- "be a list of names from the list $allValues"));
- }
- values.add(value);
- }
- return values;
- }
-
- /**
* Determine if the datum is a map. Note: null is considered a synonym for
* the empty map.
*/
« no previous file with comments | « pkg/analysis_server/lib/src/operation/operation_analysis.dart ('k') | pkg/analysis_server/test/analysis/get_errors_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698