| 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 a10e74a07f5070a974d07c9a1a8f7730d9f17002..0d3da052527717d462efd3888e6f7116f3a46d6c 100644
|
| --- a/pkg/analysis_server/lib/src/protocol.dart
|
| +++ b/pkg/analysis_server/lib/src/protocol.dart
|
| @@ -23,6 +23,10 @@ import 'package:analyzer/src/generated/source.dart' as engine;
|
|
|
| part 'generated_protocol.dart';
|
|
|
| +
|
| +final Map<String, RefactoringKind> REQUEST_ID_REFACTORING_KINDS =
|
| + new HashMap<String, RefactoringKind>();
|
| +
|
| /**
|
| * Translate the input [map], applying [keyCallback] to all its keys, and
|
| * [valueCallback] to all its values.
|
| @@ -396,6 +400,29 @@ OverriddenMember _overriddenMemberFromEngine(engine.Element member) {
|
|
|
|
|
| /**
|
| + * Create a [RefactoringFeedback] corresponding the given [kind].
|
| + */
|
| +RefactoringFeedback _refactoringFeedbackFromJson(JsonDecoder jsonDecoder,
|
| + String jsonPath, Object json, Map feedbackJson) {
|
| + String requestId;
|
| + if (jsonDecoder is ResponseDecoder) {
|
| + requestId = jsonDecoder.response.id;
|
| + }
|
| + RefactoringKind kind = REQUEST_ID_REFACTORING_KINDS[requestId];
|
| + if (kind == RefactoringKind.EXTRACT_LOCAL_VARIABLE) {
|
| + return new ExtractLocalVariableFeedback.fromJson(jsonDecoder, jsonPath, json);
|
| + }
|
| + if (kind == RefactoringKind.EXTRACT_METHOD) {
|
| + return new ExtractMethodFeedback.fromJson(jsonDecoder, jsonPath, json);
|
| + }
|
| + if (kind == RefactoringKind.RENAME) {
|
| + return new RenameFeedback.fromJson(jsonDecoder, jsonPath, json);
|
| + }
|
| + return null;
|
| +}
|
| +
|
| +
|
| +/**
|
| * Create a [RefactoringOptions] corresponding the given [kind].
|
| */
|
| RefactoringOptions _refactoringOptionsFromJson(JsonDecoder jsonDecoder,
|
| @@ -856,7 +883,7 @@ class Response {
|
| Object error = json[Response.ERROR];
|
| RequestError decodedError;
|
| if (error is Map) {
|
| - decodedError = new RequestError.fromJson(new ResponseDecoder(),
|
| + decodedError = new RequestError.fromJson(new ResponseDecoder(null),
|
| '.error', error);
|
| }
|
| Object result = json[Response.RESULT];
|
| @@ -939,6 +966,10 @@ class Response {
|
| * used only for testing. Errors are reported using bare [Exception] objects.
|
| */
|
| class ResponseDecoder extends JsonDecoder {
|
| + final Response response;
|
| +
|
| + ResponseDecoder(this.response);
|
| +
|
| @override
|
| dynamic mismatch(String jsonPath, String expected) {
|
| return new Exception('Expected $expected at $jsonPath');
|
|
|