| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library protocol; | 5 library protocol; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import 'dart:convert'; | 8 import 'dart:convert'; |
| 9 | 9 |
| 10 part 'generated_protocol.dart'; | 10 part 'generated_protocol.dart'; |
| (...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 756 */ | 756 */ |
| 757 Response.getErrorsInvalidFile(Request request) | 757 Response.getErrorsInvalidFile(Request request) |
| 758 : this( | 758 : this( |
| 759 request.id, | 759 request.id, |
| 760 error: new RequestError( | 760 error: new RequestError( |
| 761 RequestErrorCode.GET_ERRORS_INVALID_FILE, | 761 RequestErrorCode.GET_ERRORS_INVALID_FILE, |
| 762 'Error during `analysis.getErrors`: invalid file.')); | 762 'Error during `analysis.getErrors`: invalid file.')); |
| 763 | 763 |
| 764 /** | 764 /** |
| 765 * Initialize a newly created instance to represent an error condition caused | 765 * Initialize a newly created instance to represent an error condition caused |
| 766 * by a [request] that specifies an execution context whose context root does |
| 767 * not exist. |
| 768 */ |
| 769 Response.invalidExecutionContext(Request request, String contextId) |
| 770 : this( |
| 771 request.id, |
| 772 error: new RequestError( |
| 773 RequestErrorCode.INVALID_EXECUTION_CONTEXT, |
| 774 "Invalid execution context: $contextId")); |
| 775 |
| 776 /** |
| 777 * Initialize a newly created instance to represent an error condition caused |
| 766 * by a [request] that had invalid parameter. [path] is the path to the | 778 * by a [request] that had invalid parameter. [path] is the path to the |
| 767 * invalid parameter, in Javascript notation (e.g. "foo.bar" means that the | 779 * invalid parameter, in Javascript notation (e.g. "foo.bar" means that the |
| 768 * parameter "foo" contained a key "bar" whose value was the wrong type). | 780 * parameter "foo" contained a key "bar" whose value was the wrong type). |
| 769 * [expectation] is a description of the type of data that was expected. | 781 * [expectation] is a description of the type of data that was expected. |
| 770 */ | 782 */ |
| 771 Response.invalidParameter(Request request, String path, String expectation) | 783 Response.invalidParameter(Request request, String path, String expectation) |
| 772 : this( | 784 : this( |
| 773 request.id, | 785 request.id, |
| 774 error: new RequestError( | 786 error: new RequestError( |
| 775 RequestErrorCode.INVALID_PARAMETER, | 787 RequestErrorCode.INVALID_PARAMETER, |
| 776 "Expected parameter $path to $expectation")); | 788 "Invalid parameter '$path'. $expectation.")); |
| 777 | 789 |
| 778 /** | 790 /** |
| 779 * Initialize a newly created instance to represent an error condition caused | 791 * Initialize a newly created instance to represent an error condition caused |
| 780 * by a malformed request. | 792 * by a malformed request. |
| 781 */ | 793 */ |
| 782 Response.invalidRequestFormat() | 794 Response.invalidRequestFormat() |
| 783 : this( | 795 : this( |
| 784 '', | 796 '', |
| 785 error: new RequestError(RequestErrorCode.INVALID_REQUEST, 'Invalid req
uest')); | 797 error: new RequestError(RequestErrorCode.INVALID_REQUEST, 'Invalid req
uest')); |
| 786 | 798 |
| 787 /** | 799 /** |
| 800 * Initialize a newly created instance to represent the |
| 801 * REFACTORING_REQUEST_CANCELLED error condition. |
| 802 */ |
| 803 Response.refactoringRequestCancelled(Request request) |
| 804 : this( |
| 805 request.id, |
| 806 error: new RequestError( |
| 807 RequestErrorCode.REFACTORING_REQUEST_CANCELLED, |
| 808 'The `edit.getRefactoring` request was cancelled.')); |
| 809 |
| 810 /** |
| 788 * Initialize a newly created instance to represent the SERVER_ERROR error | 811 * Initialize a newly created instance to represent the SERVER_ERROR error |
| 789 * condition. | 812 * condition. |
| 790 */ | 813 */ |
| 791 factory Response.serverError(Request request, exception, stackTrace) { | 814 factory Response.serverError(Request request, exception, stackTrace) { |
| 792 RequestError error = | 815 RequestError error = |
| 793 new RequestError(RequestErrorCode.SERVER_ERROR, exception.toString()); | 816 new RequestError(RequestErrorCode.SERVER_ERROR, exception.toString()); |
| 794 if (stackTrace != null) { | 817 if (stackTrace != null) { |
| 795 error.stackTrace = stackTrace.toString(); | 818 error.stackTrace = stackTrace.toString(); |
| 796 } | 819 } |
| 797 return new Response(request.id, error: error); | 820 return new Response(request.id, error: error); |
| 798 } | 821 } |
| 799 | 822 |
| 800 /** | 823 /** |
| 801 * Initialize a newly created instance to represent the | 824 * Initialize a newly created instance to represent the |
| 802 * SORT_MEMBERS_INVALID_FILE error condition. | 825 * SORT_MEMBERS_INVALID_FILE error condition. |
| 803 */ | 826 */ |
| 804 Response.sortMembersInvalidFile(Request request) | 827 Response.sortMembersInvalidFile(Request request) |
| 805 : this( | 828 : this( |
| 806 request.id, | 829 request.id, |
| 807 error: new RequestError( | 830 error: new RequestError( |
| 808 RequestErrorCode.SORT_MEMBERS_INVALID_FILE, | 831 RequestErrorCode.SORT_MEMBERS_INVALID_FILE, |
| 809 'Error during `edit.sortMembers`: invalid file.')); | 832 'Error during `edit.sortMembers`: invalid file.')); |
| 810 | 833 |
| 811 /** | 834 /** |
| 812 * Initialize a newly created instance to represent the | 835 * Initialize a newly created instance to represent the |
| 813 * REFACTORING_REQUEST_CANCELLED error condition. | |
| 814 */ | |
| 815 Response.refactoringRequestCancelled(Request request) | |
| 816 : this( | |
| 817 request.id, | |
| 818 error: new RequestError( | |
| 819 RequestErrorCode.REFACTORING_REQUEST_CANCELLED, | |
| 820 'The `edit.getRefactoring` request was cancelled.')); | |
| 821 | |
| 822 /** | |
| 823 * Initialize a newly created instance to represent the | |
| 824 * SORT_MEMBERS_PARSE_ERRORS error condition. | 836 * SORT_MEMBERS_PARSE_ERRORS error condition. |
| 825 */ | 837 */ |
| 826 Response.sortMembersParseErrors(Request request, int numErrors) | 838 Response.sortMembersParseErrors(Request request, int numErrors) |
| 827 : this( | 839 : this( |
| 828 request.id, | 840 request.id, |
| 829 error: new RequestError( | 841 error: new RequestError( |
| 830 RequestErrorCode.SORT_MEMBERS_PARSE_ERRORS, | 842 RequestErrorCode.SORT_MEMBERS_PARSE_ERRORS, |
| 831 'Error during `edit.sortMembers`: file has $numErrors scan/parse e
rrors.')); | 843 'Error during `edit.sortMembers`: file has $numErrors scan/parse e
rrors.')); |
| 832 | 844 |
| 833 /** | 845 /** |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 910 hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); | 922 hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); |
| 911 hash = hash ^ (hash >> 11); | 923 hash = hash ^ (hash >> 11); |
| 912 return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); | 924 return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); |
| 913 } | 925 } |
| 914 | 926 |
| 915 static int hash2(a, b) => finish(combine(combine(0, a), b)); | 927 static int hash2(a, b) => finish(combine(combine(0, a), b)); |
| 916 | 928 |
| 917 static int hash4(a, b, c, d) => | 929 static int hash4(a, b, c, d) => |
| 918 finish(combine(combine(combine(combine(0, a), b), c), d)); | 930 finish(combine(combine(combine(combine(0, a), b), c), d)); |
| 919 } | 931 } |
| OLD | NEW |