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

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

Issue 2844273003: Unify the server and plugin versions of the generators (Closed)
Patch Set: add missed files Created 3 years, 8 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/protocol_internal.dart
diff --git a/pkg/analysis_server/lib/src/protocol/protocol_internal.dart b/pkg/analysis_server/lib/src/protocol/protocol_internal.dart
index e2697f317e8cf3cfed37aede4a0fdba556019fe3..38e5fbac53600a898074fbb50e6a75e4073bf176 100644
--- a/pkg/analysis_server/lib/src/protocol/protocol_internal.dart
+++ b/pkg/analysis_server/lib/src/protocol/protocol_internal.dart
@@ -7,7 +7,8 @@ library analysis_server.src.protocol.protocol_internal;
import 'dart:collection';
import 'dart:convert' hide JsonDecoder;
-import 'package:analysis_server/plugin/protocol/protocol.dart';
+import 'package:analysis_server/protocol/protocol.dart';
+import 'package:analysis_server/protocol/protocol_generated.dart';
final Map<String, RefactoringKind> REQUEST_ID_REFACTORING_KINDS =
new HashMap<String, RefactoringKind>();
@@ -244,31 +245,6 @@ abstract class HasToJson {
}
/**
- * Jenkins hash function, optimized for small integers. Borrowed from
- * sdk/lib/math/jenkins_smi_hash.dart.
- *
- * TODO(paulberry): Move to somewhere that can be shared with other code.
- */
-class JenkinsSmiHash {
- static int combine(int hash, int value) {
- hash = 0x1fffffff & (hash + value);
- hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
- return hash ^ (hash >> 6);
- }
-
- static int finish(int hash) {
- hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
- hash = hash ^ (hash >> 11);
- return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
- }
-
- static int hash2(a, b) => finish(combine(combine(0, a), b));
-
- static int hash4(a, b, c, d) =>
- finish(combine(combine(combine(combine(0, a), b), c), d));
-}
-
-/**
* Base class for decoding JSON objects. The derived class must implement
* error reporting logic.
*/
@@ -446,6 +422,14 @@ class RequestDecoder extends JsonDecoder {
}
}
+abstract class RequestParams implements HasToJson {
+ /**
+ * Return a request whose parameters are taken from this object and that has
+ * the given [id].
+ */
+ Request toRequest(String id);
+}
+
/**
* JsonDecoder for decoding responses from the server. This is intended to be
* used only for testing. Errors are reported using bare [Exception] objects.
@@ -475,3 +459,14 @@ class ResponseDecoder extends JsonDecoder {
return new Exception('Missing key $key at $jsonPath');
}
}
+
+/**
+ * The result data associated with a response.
+ */
+abstract class ResponseResult implements HasToJson {
+ /**
+ * Return a response whose result data is this object for the request with the
+ * given [id].
+ */
+ Response toResponse(String id);
+}
« no previous file with comments | « pkg/analysis_server/lib/src/plugin/server_plugin.dart ('k') | pkg/analysis_server/lib/src/protocol_server.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698