| 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 // This file has been automatically generated. Please do not edit it manually. | 5 // This file has been automatically generated. Please do not edit it manually. |
| 6 // To regenerate the file, use the script | 6 // To regenerate the file, use the script |
| 7 // "pkg/analysis_server/tool/spec/generate_files". | 7 // "pkg/analysis_server/tool/spec/generate_files". |
| 8 | 8 |
| 9 part of protocol; | 9 part of protocol; |
| 10 /** | 10 /** |
| (...skipping 4378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4389 * | 4389 * |
| 4390 * { | 4390 * { |
| 4391 * "severity": AnalysisErrorSeverity | 4391 * "severity": AnalysisErrorSeverity |
| 4392 * "type": AnalysisErrorType | 4392 * "type": AnalysisErrorType |
| 4393 * "location": Location | 4393 * "location": Location |
| 4394 * "message": String | 4394 * "message": String |
| 4395 * "correction": optional String | 4395 * "correction": optional String |
| 4396 * } | 4396 * } |
| 4397 */ | 4397 */ |
| 4398 class AnalysisError implements HasToJson { | 4398 class AnalysisError implements HasToJson { |
| 4399 /** | |
| 4400 * Returns a list of AnalysisErrors correponding to the given list of Engine | |
| 4401 * errors. | |
| 4402 */ | |
| 4403 static List<AnalysisError> listFromEngine(engine.LineInfo lineInfo, List<engin
e.AnalysisError> errors) => | |
| 4404 _analysisErrorListFromEngine(lineInfo, errors); | |
| 4405 | 4399 |
| 4406 /** | 4400 /** |
| 4407 * The severity of the error. | 4401 * The severity of the error. |
| 4408 */ | 4402 */ |
| 4409 AnalysisErrorSeverity severity; | 4403 AnalysisErrorSeverity severity; |
| 4410 | 4404 |
| 4411 /** | 4405 /** |
| 4412 * The type of the error. | 4406 * The type of the error. |
| 4413 */ | 4407 */ |
| 4414 AnalysisErrorType type; | 4408 AnalysisErrorType type; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4465 String correction; | 4459 String correction; |
| 4466 if (json.containsKey("correction")) { | 4460 if (json.containsKey("correction")) { |
| 4467 correction = jsonDecoder._decodeString(jsonPath + ".correction", json["c
orrection"]); | 4461 correction = jsonDecoder._decodeString(jsonPath + ".correction", json["c
orrection"]); |
| 4468 } | 4462 } |
| 4469 return new AnalysisError(severity, type, location, message, correction: co
rrection); | 4463 return new AnalysisError(severity, type, location, message, correction: co
rrection); |
| 4470 } else { | 4464 } else { |
| 4471 throw jsonDecoder.mismatch(jsonPath, "AnalysisError"); | 4465 throw jsonDecoder.mismatch(jsonPath, "AnalysisError"); |
| 4472 } | 4466 } |
| 4473 } | 4467 } |
| 4474 | 4468 |
| 4475 /** | |
| 4476 * Construct based on error information from the analyzer engine. | |
| 4477 */ | |
| 4478 factory AnalysisError.fromEngine(engine.LineInfo lineInfo, engine.AnalysisErro
r error) => | |
| 4479 _analysisErrorFromEngine(lineInfo, error); | |
| 4480 | |
| 4481 Map<String, dynamic> toJson() { | 4469 Map<String, dynamic> toJson() { |
| 4482 Map<String, dynamic> result = {}; | 4470 Map<String, dynamic> result = {}; |
| 4483 result["severity"] = severity.toJson(); | 4471 result["severity"] = severity.toJson(); |
| 4484 result["type"] = type.toJson(); | 4472 result["type"] = type.toJson(); |
| 4485 result["location"] = location.toJson(); | 4473 result["location"] = location.toJson(); |
| 4486 result["message"] = message; | 4474 result["message"] = message; |
| 4487 if (correction != null) { | 4475 if (correction != null) { |
| 4488 result["correction"] = correction; | 4476 result["correction"] = correction; |
| 4489 } | 4477 } |
| 4490 return result; | 4478 return result; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4565 } | 4553 } |
| 4566 } | 4554 } |
| 4567 | 4555 |
| 4568 Map<String, dynamic> toJson() { | 4556 Map<String, dynamic> toJson() { |
| 4569 Map<String, dynamic> result = {}; | 4557 Map<String, dynamic> result = {}; |
| 4570 result["error"] = error.toJson(); | 4558 result["error"] = error.toJson(); |
| 4571 result["fixes"] = fixes.map((SourceChange value) => value.toJson()).toList()
; | 4559 result["fixes"] = fixes.map((SourceChange value) => value.toJson()).toList()
; |
| 4572 return result; | 4560 return result; |
| 4573 } | 4561 } |
| 4574 | 4562 |
| 4575 /** | |
| 4576 * Add a [Fix] | |
| 4577 */ | |
| 4578 void addFix(Fix fix) { | |
| 4579 fixes.add(fix.change); | |
| 4580 } | |
| 4581 | |
| 4582 @override | 4563 @override |
| 4583 String toString() => JSON.encode(toJson()); | 4564 String toString() => JSON.encode(toJson()); |
| 4584 | 4565 |
| 4585 @override | 4566 @override |
| 4586 bool operator==(other) { | 4567 bool operator==(other) { |
| 4587 if (other is AnalysisErrorFixes) { | 4568 if (other is AnalysisErrorFixes) { |
| 4588 return error == other.error && | 4569 return error == other.error && |
| 4589 _listEqual(fixes, other.fixes, (SourceChange a, SourceChange b) => a =
= b); | 4570 _listEqual(fixes, other.fixes, (SourceChange a, SourceChange b) => a =
= b); |
| 4590 } | 4571 } |
| 4591 return false; | 4572 return false; |
| (...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5560 if (json is String) { | 5541 if (json is String) { |
| 5561 try { | 5542 try { |
| 5562 return new CompletionSuggestionKind(json); | 5543 return new CompletionSuggestionKind(json); |
| 5563 } catch(_) { | 5544 } catch(_) { |
| 5564 // Fall through | 5545 // Fall through |
| 5565 } | 5546 } |
| 5566 } | 5547 } |
| 5567 throw jsonDecoder.mismatch(jsonPath, "CompletionSuggestionKind"); | 5548 throw jsonDecoder.mismatch(jsonPath, "CompletionSuggestionKind"); |
| 5568 } | 5549 } |
| 5569 | 5550 |
| 5570 /** | |
| 5571 * Construct from an analyzer engine element kind. | |
| 5572 */ | |
| 5573 factory CompletionSuggestionKind.fromElementKind(engine.ElementKind kind) => | |
| 5574 _completionSuggestionKindFromElementKind(kind); | |
| 5575 | |
| 5576 @override | 5551 @override |
| 5577 String toString() => "CompletionSuggestionKind.$name"; | 5552 String toString() => "CompletionSuggestionKind.$name"; |
| 5578 | 5553 |
| 5579 String toJson() => name; | 5554 String toJson() => name; |
| 5580 } | 5555 } |
| 5581 | 5556 |
| 5582 /** | 5557 /** |
| 5583 * Element | 5558 * Element |
| 5584 * | 5559 * |
| 5585 * { | 5560 * { |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5689 String returnType; | 5664 String returnType; |
| 5690 if (json.containsKey("returnType")) { | 5665 if (json.containsKey("returnType")) { |
| 5691 returnType = jsonDecoder._decodeString(jsonPath + ".returnType", json["r
eturnType"]); | 5666 returnType = jsonDecoder._decodeString(jsonPath + ".returnType", json["r
eturnType"]); |
| 5692 } | 5667 } |
| 5693 return new Element(kind, name, flags, location: location, parameters: para
meters, returnType: returnType); | 5668 return new Element(kind, name, flags, location: location, parameters: para
meters, returnType: returnType); |
| 5694 } else { | 5669 } else { |
| 5695 throw jsonDecoder.mismatch(jsonPath, "Element"); | 5670 throw jsonDecoder.mismatch(jsonPath, "Element"); |
| 5696 } | 5671 } |
| 5697 } | 5672 } |
| 5698 | 5673 |
| 5699 /** | |
| 5700 * Construct based on a value from the analyzer engine. | |
| 5701 */ | |
| 5702 factory Element.fromEngine(engine.Element element) => | |
| 5703 elementFromEngine(element); | |
| 5704 | |
| 5705 bool get isAbstract => (flags & FLAG_ABSTRACT) != 0; | 5674 bool get isAbstract => (flags & FLAG_ABSTRACT) != 0; |
| 5706 bool get isConst => (flags & FLAG_CONST) != 0; | 5675 bool get isConst => (flags & FLAG_CONST) != 0; |
| 5707 bool get isFinal => (flags & FLAG_FINAL) != 0; | 5676 bool get isFinal => (flags & FLAG_FINAL) != 0; |
| 5708 bool get isStatic => (flags & FLAG_STATIC) != 0; | 5677 bool get isStatic => (flags & FLAG_STATIC) != 0; |
| 5709 bool get isPrivate => (flags & FLAG_PRIVATE) != 0; | 5678 bool get isPrivate => (flags & FLAG_PRIVATE) != 0; |
| 5710 bool get isDeprecated => (flags & FLAG_DEPRECATED) != 0; | 5679 bool get isDeprecated => (flags & FLAG_DEPRECATED) != 0; |
| 5711 | 5680 |
| 5712 Map<String, dynamic> toJson() { | 5681 Map<String, dynamic> toJson() { |
| 5713 Map<String, dynamic> result = {}; | 5682 Map<String, dynamic> result = {}; |
| 5714 result["kind"] = kind.toJson(); | 5683 result["kind"] = kind.toJson(); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5765 * CONSTRUCTOR | 5734 * CONSTRUCTOR |
| 5766 * FIELD | 5735 * FIELD |
| 5767 * FUNCTION | 5736 * FUNCTION |
| 5768 * FUNCTION_TYPE_ALIAS | 5737 * FUNCTION_TYPE_ALIAS |
| 5769 * GETTER | 5738 * GETTER |
| 5770 * LABEL | 5739 * LABEL |
| 5771 * LIBRARY | 5740 * LIBRARY |
| 5772 * LOCAL_VARIABLE | 5741 * LOCAL_VARIABLE |
| 5773 * METHOD | 5742 * METHOD |
| 5774 * PARAMETER | 5743 * PARAMETER |
| 5775 * PREFIX | |
| 5776 * SETTER | 5744 * SETTER |
| 5777 * TOP_LEVEL_VARIABLE | 5745 * TOP_LEVEL_VARIABLE |
| 5778 * TYPE_PARAMETER | 5746 * TYPE_PARAMETER |
| 5779 * UNIT_TEST_GROUP | 5747 * UNIT_TEST_GROUP |
| 5780 * UNIT_TEST_TEST | 5748 * UNIT_TEST_TEST |
| 5781 * UNKNOWN | 5749 * UNKNOWN |
| 5782 * } | 5750 * } |
| 5783 */ | 5751 */ |
| 5784 class ElementKind { | 5752 class ElementKind { |
| 5785 static const CLASS = const ElementKind._("CLASS"); | 5753 static const CLASS = const ElementKind._("CLASS"); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 5801 static const LABEL = const ElementKind._("LABEL"); | 5769 static const LABEL = const ElementKind._("LABEL"); |
| 5802 | 5770 |
| 5803 static const LIBRARY = const ElementKind._("LIBRARY"); | 5771 static const LIBRARY = const ElementKind._("LIBRARY"); |
| 5804 | 5772 |
| 5805 static const LOCAL_VARIABLE = const ElementKind._("LOCAL_VARIABLE"); | 5773 static const LOCAL_VARIABLE = const ElementKind._("LOCAL_VARIABLE"); |
| 5806 | 5774 |
| 5807 static const METHOD = const ElementKind._("METHOD"); | 5775 static const METHOD = const ElementKind._("METHOD"); |
| 5808 | 5776 |
| 5809 static const PARAMETER = const ElementKind._("PARAMETER"); | 5777 static const PARAMETER = const ElementKind._("PARAMETER"); |
| 5810 | 5778 |
| 5811 static const PREFIX = const ElementKind._("PREFIX"); | |
| 5812 | |
| 5813 static const SETTER = const ElementKind._("SETTER"); | 5779 static const SETTER = const ElementKind._("SETTER"); |
| 5814 | 5780 |
| 5815 static const TOP_LEVEL_VARIABLE = const ElementKind._("TOP_LEVEL_VARIABLE"); | 5781 static const TOP_LEVEL_VARIABLE = const ElementKind._("TOP_LEVEL_VARIABLE"); |
| 5816 | 5782 |
| 5817 static const TYPE_PARAMETER = const ElementKind._("TYPE_PARAMETER"); | 5783 static const TYPE_PARAMETER = const ElementKind._("TYPE_PARAMETER"); |
| 5818 | 5784 |
| 5819 static const UNIT_TEST_GROUP = const ElementKind._("UNIT_TEST_GROUP"); | 5785 static const UNIT_TEST_GROUP = const ElementKind._("UNIT_TEST_GROUP"); |
| 5820 | 5786 |
| 5821 static const UNIT_TEST_TEST = const ElementKind._("UNIT_TEST_TEST"); | 5787 static const UNIT_TEST_TEST = const ElementKind._("UNIT_TEST_TEST"); |
| 5822 | 5788 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 5847 case "LABEL": | 5813 case "LABEL": |
| 5848 return LABEL; | 5814 return LABEL; |
| 5849 case "LIBRARY": | 5815 case "LIBRARY": |
| 5850 return LIBRARY; | 5816 return LIBRARY; |
| 5851 case "LOCAL_VARIABLE": | 5817 case "LOCAL_VARIABLE": |
| 5852 return LOCAL_VARIABLE; | 5818 return LOCAL_VARIABLE; |
| 5853 case "METHOD": | 5819 case "METHOD": |
| 5854 return METHOD; | 5820 return METHOD; |
| 5855 case "PARAMETER": | 5821 case "PARAMETER": |
| 5856 return PARAMETER; | 5822 return PARAMETER; |
| 5857 case "PREFIX": | |
| 5858 return PREFIX; | |
| 5859 case "SETTER": | 5823 case "SETTER": |
| 5860 return SETTER; | 5824 return SETTER; |
| 5861 case "TOP_LEVEL_VARIABLE": | 5825 case "TOP_LEVEL_VARIABLE": |
| 5862 return TOP_LEVEL_VARIABLE; | 5826 return TOP_LEVEL_VARIABLE; |
| 5863 case "TYPE_PARAMETER": | 5827 case "TYPE_PARAMETER": |
| 5864 return TYPE_PARAMETER; | 5828 return TYPE_PARAMETER; |
| 5865 case "UNIT_TEST_GROUP": | 5829 case "UNIT_TEST_GROUP": |
| 5866 return UNIT_TEST_GROUP; | 5830 return UNIT_TEST_GROUP; |
| 5867 case "UNIT_TEST_TEST": | 5831 case "UNIT_TEST_TEST": |
| 5868 return UNIT_TEST_TEST; | 5832 return UNIT_TEST_TEST; |
| 5869 case "UNKNOWN": | 5833 case "UNKNOWN": |
| 5870 return UNKNOWN; | 5834 return UNKNOWN; |
| 5871 } | 5835 } |
| 5872 throw new Exception('Illegal enum value: $name'); | 5836 throw new Exception('Illegal enum value: $name'); |
| 5873 } | 5837 } |
| 5874 | 5838 |
| 5875 factory ElementKind.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object
json) { | 5839 factory ElementKind.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object
json) { |
| 5876 if (json is String) { | 5840 if (json is String) { |
| 5877 try { | 5841 try { |
| 5878 return new ElementKind(json); | 5842 return new ElementKind(json); |
| 5879 } catch(_) { | 5843 } catch(_) { |
| 5880 // Fall through | 5844 // Fall through |
| 5881 } | 5845 } |
| 5882 } | 5846 } |
| 5883 throw jsonDecoder.mismatch(jsonPath, "ElementKind"); | 5847 throw jsonDecoder.mismatch(jsonPath, "ElementKind"); |
| 5884 } | 5848 } |
| 5885 | 5849 |
| 5886 /** | |
| 5887 * Construct based on a value from the analyzer engine. | |
| 5888 */ | |
| 5889 factory ElementKind.fromEngine(engine.ElementKind kind) => | |
| 5890 _elementKindFromEngine(kind); | |
| 5891 | |
| 5892 @override | 5850 @override |
| 5893 String toString() => "ElementKind.$name"; | 5851 String toString() => "ElementKind.$name"; |
| 5894 | 5852 |
| 5895 String toJson() => name; | 5853 String toJson() => name; |
| 5896 } | 5854 } |
| 5897 | 5855 |
| 5898 /** | 5856 /** |
| 5899 * ExecutableFile | 5857 * ExecutableFile |
| 5900 * | 5858 * |
| 5901 * { | 5859 * { |
| (...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7020 startColumn = jsonDecoder._decodeInt(jsonPath + ".startColumn", json["st
artColumn"]); | 6978 startColumn = jsonDecoder._decodeInt(jsonPath + ".startColumn", json["st
artColumn"]); |
| 7021 } else { | 6979 } else { |
| 7022 throw jsonDecoder.missingKey(jsonPath, "startColumn"); | 6980 throw jsonDecoder.missingKey(jsonPath, "startColumn"); |
| 7023 } | 6981 } |
| 7024 return new Location(file, offset, length, startLine, startColumn); | 6982 return new Location(file, offset, length, startLine, startColumn); |
| 7025 } else { | 6983 } else { |
| 7026 throw jsonDecoder.mismatch(jsonPath, "Location"); | 6984 throw jsonDecoder.mismatch(jsonPath, "Location"); |
| 7027 } | 6985 } |
| 7028 } | 6986 } |
| 7029 | 6987 |
| 7030 /** | |
| 7031 * Create a Location based on an [engine.Element]. | |
| 7032 */ | |
| 7033 factory Location.fromElement(engine.Element element) => | |
| 7034 _locationFromElement(element); | |
| 7035 | |
| 7036 /** | |
| 7037 * Create a Location based on an [engine.SearchMatch]. | |
| 7038 */ | |
| 7039 factory Location.fromMatch(engine.SearchMatch match) => | |
| 7040 _locationFromMatch(match); | |
| 7041 | |
| 7042 /** | |
| 7043 * Create a Location based on an [engine.AstNode]. | |
| 7044 */ | |
| 7045 factory Location.fromNode(engine.AstNode node) => | |
| 7046 _locationFromNode(node); | |
| 7047 | |
| 7048 /** | |
| 7049 * Create a Location based on an [engine.CompilationUnit]. | |
| 7050 */ | |
| 7051 factory Location.fromUnit(engine.CompilationUnit unit, engine.SourceRange rang
e) => | |
| 7052 _locationFromUnit(unit, range); | |
| 7053 | |
| 7054 Map<String, dynamic> toJson() { | 6988 Map<String, dynamic> toJson() { |
| 7055 Map<String, dynamic> result = {}; | 6989 Map<String, dynamic> result = {}; |
| 7056 result["file"] = file; | 6990 result["file"] = file; |
| 7057 result["offset"] = offset; | 6991 result["offset"] = offset; |
| 7058 result["length"] = length; | 6992 result["length"] = length; |
| 7059 result["startLine"] = startLine; | 6993 result["startLine"] = startLine; |
| 7060 result["startColumn"] = startColumn; | 6994 result["startColumn"] = startColumn; |
| 7061 return result; | 6995 return result; |
| 7062 } | 6996 } |
| 7063 | 6997 |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7524 className = jsonDecoder._decodeString(jsonPath + ".className", json["cla
ssName"]); | 7458 className = jsonDecoder._decodeString(jsonPath + ".className", json["cla
ssName"]); |
| 7525 } else { | 7459 } else { |
| 7526 throw jsonDecoder.missingKey(jsonPath, "className"); | 7460 throw jsonDecoder.missingKey(jsonPath, "className"); |
| 7527 } | 7461 } |
| 7528 return new OverriddenMember(element, className); | 7462 return new OverriddenMember(element, className); |
| 7529 } else { | 7463 } else { |
| 7530 throw jsonDecoder.mismatch(jsonPath, "OverriddenMember"); | 7464 throw jsonDecoder.mismatch(jsonPath, "OverriddenMember"); |
| 7531 } | 7465 } |
| 7532 } | 7466 } |
| 7533 | 7467 |
| 7534 /** | |
| 7535 * Construct based on an element from the analyzer engine. | |
| 7536 */ | |
| 7537 factory OverriddenMember.fromEngine(engine.Element member) => | |
| 7538 _overriddenMemberFromEngine(member); | |
| 7539 | |
| 7540 Map<String, dynamic> toJson() { | 7468 Map<String, dynamic> toJson() { |
| 7541 Map<String, dynamic> result = {}; | 7469 Map<String, dynamic> result = {}; |
| 7542 result["element"] = element.toJson(); | 7470 result["element"] = element.toJson(); |
| 7543 result["className"] = className; | 7471 result["className"] = className; |
| 7544 return result; | 7472 return result; |
| 7545 } | 7473 } |
| 7546 | 7474 |
| 7547 @override | 7475 @override |
| 7548 String toString() => JSON.encode(toJson()); | 7476 String toString() => JSON.encode(toJson()); |
| 7549 | 7477 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7640 /** | 7568 /** |
| 7641 * RefactoringKind | 7569 * RefactoringKind |
| 7642 * | 7570 * |
| 7643 * enum { | 7571 * enum { |
| 7644 * CONVERT_GETTER_TO_METHOD | 7572 * CONVERT_GETTER_TO_METHOD |
| 7645 * CONVERT_METHOD_TO_GETTER | 7573 * CONVERT_METHOD_TO_GETTER |
| 7646 * EXTRACT_LOCAL_VARIABLE | 7574 * EXTRACT_LOCAL_VARIABLE |
| 7647 * EXTRACT_METHOD | 7575 * EXTRACT_METHOD |
| 7648 * INLINE_LOCAL_VARIABLE | 7576 * INLINE_LOCAL_VARIABLE |
| 7649 * INLINE_METHOD | 7577 * INLINE_METHOD |
| 7650 * MOVE_FILE | |
| 7651 * RENAME | 7578 * RENAME |
| 7652 * } | 7579 * } |
| 7653 */ | 7580 */ |
| 7654 class RefactoringKind { | 7581 class RefactoringKind { |
| 7655 static const CONVERT_GETTER_TO_METHOD = const RefactoringKind._("CONVERT_GETTE
R_TO_METHOD"); | 7582 static const CONVERT_GETTER_TO_METHOD = const RefactoringKind._("CONVERT_GETTE
R_TO_METHOD"); |
| 7656 | 7583 |
| 7657 static const CONVERT_METHOD_TO_GETTER = const RefactoringKind._("CONVERT_METHO
D_TO_GETTER"); | 7584 static const CONVERT_METHOD_TO_GETTER = const RefactoringKind._("CONVERT_METHO
D_TO_GETTER"); |
| 7658 | 7585 |
| 7659 static const EXTRACT_LOCAL_VARIABLE = const RefactoringKind._("EXTRACT_LOCAL_V
ARIABLE"); | 7586 static const EXTRACT_LOCAL_VARIABLE = const RefactoringKind._("EXTRACT_LOCAL_V
ARIABLE"); |
| 7660 | 7587 |
| 7661 static const EXTRACT_METHOD = const RefactoringKind._("EXTRACT_METHOD"); | 7588 static const EXTRACT_METHOD = const RefactoringKind._("EXTRACT_METHOD"); |
| 7662 | 7589 |
| 7663 static const INLINE_LOCAL_VARIABLE = const RefactoringKind._("INLINE_LOCAL_VAR
IABLE"); | 7590 static const INLINE_LOCAL_VARIABLE = const RefactoringKind._("INLINE_LOCAL_VAR
IABLE"); |
| 7664 | 7591 |
| 7665 static const INLINE_METHOD = const RefactoringKind._("INLINE_METHOD"); | 7592 static const INLINE_METHOD = const RefactoringKind._("INLINE_METHOD"); |
| 7666 | 7593 |
| 7667 static const MOVE_FILE = const RefactoringKind._("MOVE_FILE"); | |
| 7668 | |
| 7669 static const RENAME = const RefactoringKind._("RENAME"); | 7594 static const RENAME = const RefactoringKind._("RENAME"); |
| 7670 | 7595 |
| 7671 final String name; | 7596 final String name; |
| 7672 | 7597 |
| 7673 const RefactoringKind._(this.name); | 7598 const RefactoringKind._(this.name); |
| 7674 | 7599 |
| 7675 factory RefactoringKind(String name) { | 7600 factory RefactoringKind(String name) { |
| 7676 switch (name) { | 7601 switch (name) { |
| 7677 case "CONVERT_GETTER_TO_METHOD": | 7602 case "CONVERT_GETTER_TO_METHOD": |
| 7678 return CONVERT_GETTER_TO_METHOD; | 7603 return CONVERT_GETTER_TO_METHOD; |
| 7679 case "CONVERT_METHOD_TO_GETTER": | 7604 case "CONVERT_METHOD_TO_GETTER": |
| 7680 return CONVERT_METHOD_TO_GETTER; | 7605 return CONVERT_METHOD_TO_GETTER; |
| 7681 case "EXTRACT_LOCAL_VARIABLE": | 7606 case "EXTRACT_LOCAL_VARIABLE": |
| 7682 return EXTRACT_LOCAL_VARIABLE; | 7607 return EXTRACT_LOCAL_VARIABLE; |
| 7683 case "EXTRACT_METHOD": | 7608 case "EXTRACT_METHOD": |
| 7684 return EXTRACT_METHOD; | 7609 return EXTRACT_METHOD; |
| 7685 case "INLINE_LOCAL_VARIABLE": | 7610 case "INLINE_LOCAL_VARIABLE": |
| 7686 return INLINE_LOCAL_VARIABLE; | 7611 return INLINE_LOCAL_VARIABLE; |
| 7687 case "INLINE_METHOD": | 7612 case "INLINE_METHOD": |
| 7688 return INLINE_METHOD; | 7613 return INLINE_METHOD; |
| 7689 case "MOVE_FILE": | |
| 7690 return MOVE_FILE; | |
| 7691 case "RENAME": | 7614 case "RENAME": |
| 7692 return RENAME; | 7615 return RENAME; |
| 7693 } | 7616 } |
| 7694 throw new Exception('Illegal enum value: $name'); | 7617 throw new Exception('Illegal enum value: $name'); |
| 7695 } | 7618 } |
| 7696 | 7619 |
| 7697 factory RefactoringKind.fromJson(JsonDecoder jsonDecoder, String jsonPath, Obj
ect json) { | 7620 factory RefactoringKind.fromJson(JsonDecoder jsonDecoder, String jsonPath, Obj
ect json) { |
| 7698 if (json is String) { | 7621 if (json is String) { |
| 7699 try { | 7622 try { |
| 7700 return new RefactoringKind(json); | 7623 return new RefactoringKind(json); |
| (...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8429 path = jsonDecoder._decodeList(jsonPath + ".path", json["path"], (String
jsonPath, Object json) => new Element.fromJson(jsonDecoder, jsonPath, json)); | 8352 path = jsonDecoder._decodeList(jsonPath + ".path", json["path"], (String
jsonPath, Object json) => new Element.fromJson(jsonDecoder, jsonPath, json)); |
| 8430 } else { | 8353 } else { |
| 8431 throw jsonDecoder.missingKey(jsonPath, "path"); | 8354 throw jsonDecoder.missingKey(jsonPath, "path"); |
| 8432 } | 8355 } |
| 8433 return new SearchResult(location, kind, isPotential, path); | 8356 return new SearchResult(location, kind, isPotential, path); |
| 8434 } else { | 8357 } else { |
| 8435 throw jsonDecoder.mismatch(jsonPath, "SearchResult"); | 8358 throw jsonDecoder.mismatch(jsonPath, "SearchResult"); |
| 8436 } | 8359 } |
| 8437 } | 8360 } |
| 8438 | 8361 |
| 8439 /** | |
| 8440 * Construct based on a value from the search engine. | |
| 8441 */ | |
| 8442 factory SearchResult.fromMatch(engine.SearchMatch match) => | |
| 8443 searchResultFromMatch(match); | |
| 8444 | |
| 8445 Map<String, dynamic> toJson() { | 8362 Map<String, dynamic> toJson() { |
| 8446 Map<String, dynamic> result = {}; | 8363 Map<String, dynamic> result = {}; |
| 8447 result["location"] = location.toJson(); | 8364 result["location"] = location.toJson(); |
| 8448 result["kind"] = kind.toJson(); | 8365 result["kind"] = kind.toJson(); |
| 8449 result["isPotential"] = isPotential; | 8366 result["isPotential"] = isPotential; |
| 8450 result["path"] = path.map((Element value) => value.toJson()).toList(); | 8367 result["path"] = path.map((Element value) => value.toJson()).toList(); |
| 8451 return result; | 8368 return result; |
| 8452 } | 8369 } |
| 8453 | 8370 |
| 8454 @override | 8371 @override |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8554 if (json is String) { | 8471 if (json is String) { |
| 8555 try { | 8472 try { |
| 8556 return new SearchResultKind(json); | 8473 return new SearchResultKind(json); |
| 8557 } catch(_) { | 8474 } catch(_) { |
| 8558 // Fall through | 8475 // Fall through |
| 8559 } | 8476 } |
| 8560 } | 8477 } |
| 8561 throw jsonDecoder.mismatch(jsonPath, "SearchResultKind"); | 8478 throw jsonDecoder.mismatch(jsonPath, "SearchResultKind"); |
| 8562 } | 8479 } |
| 8563 | 8480 |
| 8564 /** | |
| 8565 * Construct based on a value from the search engine. | |
| 8566 */ | |
| 8567 factory SearchResultKind.fromEngine(engine.MatchKind kind) => | |
| 8568 _searchResultKindFromEngine(kind); | |
| 8569 | |
| 8570 @override | 8481 @override |
| 8571 String toString() => "SearchResultKind.$name"; | 8482 String toString() => "SearchResultKind.$name"; |
| 8572 | 8483 |
| 8573 String toJson() => name; | 8484 String toJson() => name; |
| 8574 } | 8485 } |
| 8575 | 8486 |
| 8576 /** | 8487 /** |
| 8577 * ServerService | 8488 * ServerService |
| 8578 * | 8489 * |
| 8579 * enum { | 8490 * enum { |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8697 return result; | 8608 return result; |
| 8698 } | 8609 } |
| 8699 | 8610 |
| 8700 /** | 8611 /** |
| 8701 * Adds [edit] to the [FileEdit] for the given [file]. | 8612 * Adds [edit] to the [FileEdit] for the given [file]. |
| 8702 */ | 8613 */ |
| 8703 void addEdit(String file, int fileStamp, SourceEdit edit) => | 8614 void addEdit(String file, int fileStamp, SourceEdit edit) => |
| 8704 _addEditToSourceChange(this, file, fileStamp, edit); | 8615 _addEditToSourceChange(this, file, fileStamp, edit); |
| 8705 | 8616 |
| 8706 /** | 8617 /** |
| 8707 * Adds [edit] to the [FileEdit] for the given [source]. | |
| 8708 */ | |
| 8709 void addSourceEdit(engine.AnalysisContext context, | |
| 8710 engine.Source source, SourceEdit edit) => | |
| 8711 _addSourceEditToSourceChange(this, context, source, edit); | |
| 8712 | |
| 8713 /** | |
| 8714 * Adds [edit] to the [FileEdit] for the given [element]. | |
| 8715 */ | |
| 8716 void addElementEdit(engine.Element element, SourceEdit edit) => | |
| 8717 _addElementEditToSourceChange(this, element, edit); | |
| 8718 | |
| 8719 /** | |
| 8720 * Adds the given [FileEdit]. | 8618 * Adds the given [FileEdit]. |
| 8721 */ | 8619 */ |
| 8722 void addFileEdit(SourceFileEdit edit) { | 8620 void addFileEdit(SourceFileEdit edit) { |
| 8723 edits.add(edit); | 8621 edits.add(edit); |
| 8724 } | 8622 } |
| 8725 | 8623 |
| 8726 /** | 8624 /** |
| 8727 * Adds the given [LinkedEditGroup]. | 8625 * Adds the given [LinkedEditGroup]. |
| 8728 */ | 8626 */ |
| 8729 void addLinkedEditGroup(LinkedEditGroup linkedEditGroup) { | 8627 void addLinkedEditGroup(LinkedEditGroup linkedEditGroup) { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8835 if (json.containsKey("id")) { | 8733 if (json.containsKey("id")) { |
| 8836 id = jsonDecoder._decodeString(jsonPath + ".id", json["id"]); | 8734 id = jsonDecoder._decodeString(jsonPath + ".id", json["id"]); |
| 8837 } | 8735 } |
| 8838 return new SourceEdit(offset, length, replacement, id: id); | 8736 return new SourceEdit(offset, length, replacement, id: id); |
| 8839 } else { | 8737 } else { |
| 8840 throw jsonDecoder.mismatch(jsonPath, "SourceEdit"); | 8738 throw jsonDecoder.mismatch(jsonPath, "SourceEdit"); |
| 8841 } | 8739 } |
| 8842 } | 8740 } |
| 8843 | 8741 |
| 8844 /** | 8742 /** |
| 8845 * Construct based on a SourceRange. | |
| 8846 */ | |
| 8847 SourceEdit.range(engine.SourceRange range, String replacement, {String id}) | |
| 8848 : this(range.offset, range.length, replacement, id: id); | |
| 8849 | |
| 8850 /** | |
| 8851 * The end of the region to be modified. | 8743 * The end of the region to be modified. |
| 8852 */ | 8744 */ |
| 8853 int get end => offset + length; | 8745 int get end => offset + length; |
| 8854 | 8746 |
| 8855 Map<String, dynamic> toJson() { | 8747 Map<String, dynamic> toJson() { |
| 8856 Map<String, dynamic> result = {}; | 8748 Map<String, dynamic> result = {}; |
| 8857 result["offset"] = offset; | 8749 result["offset"] = offset; |
| 8858 result["length"] = length; | 8750 result["length"] = length; |
| 8859 result["replacement"] = replacement; | 8751 result["replacement"] = replacement; |
| 8860 if (id != null) { | 8752 if (id != null) { |
| (...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9957 } | 9849 } |
| 9958 | 9850 |
| 9959 @override | 9851 @override |
| 9960 int get hashCode { | 9852 int get hashCode { |
| 9961 int hash = 0; | 9853 int hash = 0; |
| 9962 hash = _JenkinsSmiHash.combine(hash, deleteSource.hashCode); | 9854 hash = _JenkinsSmiHash.combine(hash, deleteSource.hashCode); |
| 9963 hash = _JenkinsSmiHash.combine(hash, inlineAll.hashCode); | 9855 hash = _JenkinsSmiHash.combine(hash, inlineAll.hashCode); |
| 9964 return _JenkinsSmiHash.finish(hash); | 9856 return _JenkinsSmiHash.finish(hash); |
| 9965 } | 9857 } |
| 9966 } | 9858 } |
| 9967 /** | |
| 9968 * moveFile feedback | |
| 9969 */ | |
| 9970 class MoveFileFeedback { | |
| 9971 @override | |
| 9972 bool operator==(other) { | |
| 9973 if (other is MoveFileFeedback) { | |
| 9974 return true; | |
| 9975 } | |
| 9976 return false; | |
| 9977 } | |
| 9978 | |
| 9979 @override | |
| 9980 int get hashCode { | |
| 9981 return 438975893; | |
| 9982 } | |
| 9983 } | |
| 9984 | |
| 9985 /** | |
| 9986 * moveFile options | |
| 9987 * | |
| 9988 * { | |
| 9989 * "newFile": FilePath | |
| 9990 * } | |
| 9991 */ | |
| 9992 class MoveFileOptions extends RefactoringOptions implements HasToJson { | |
| 9993 /** | |
| 9994 * The new file path to which the given file is being moved. | |
| 9995 */ | |
| 9996 String newFile; | |
| 9997 | |
| 9998 MoveFileOptions(this.newFile); | |
| 9999 | |
| 10000 factory MoveFileOptions.fromJson(JsonDecoder jsonDecoder, String jsonPath, Obj
ect json) { | |
| 10001 if (json == null) { | |
| 10002 json = {}; | |
| 10003 } | |
| 10004 if (json is Map) { | |
| 10005 String newFile; | |
| 10006 if (json.containsKey("newFile")) { | |
| 10007 newFile = jsonDecoder._decodeString(jsonPath + ".newFile", json["newFile
"]); | |
| 10008 } else { | |
| 10009 throw jsonDecoder.missingKey(jsonPath, "newFile"); | |
| 10010 } | |
| 10011 return new MoveFileOptions(newFile); | |
| 10012 } else { | |
| 10013 throw jsonDecoder.mismatch(jsonPath, "moveFile options"); | |
| 10014 } | |
| 10015 } | |
| 10016 | |
| 10017 factory MoveFileOptions.fromRefactoringParams(EditGetRefactoringParams refacto
ringParams, Request request) { | |
| 10018 return new MoveFileOptions.fromJson( | |
| 10019 new RequestDecoder(request), "options", refactoringParams.options); | |
| 10020 } | |
| 10021 | |
| 10022 Map<String, dynamic> toJson() { | |
| 10023 Map<String, dynamic> result = {}; | |
| 10024 result["newFile"] = newFile; | |
| 10025 return result; | |
| 10026 } | |
| 10027 | |
| 10028 @override | |
| 10029 String toString() => JSON.encode(toJson()); | |
| 10030 | |
| 10031 @override | |
| 10032 bool operator==(other) { | |
| 10033 if (other is MoveFileOptions) { | |
| 10034 return newFile == other.newFile; | |
| 10035 } | |
| 10036 return false; | |
| 10037 } | |
| 10038 | |
| 10039 @override | |
| 10040 int get hashCode { | |
| 10041 int hash = 0; | |
| 10042 hash = _JenkinsSmiHash.combine(hash, newFile.hashCode); | |
| 10043 return _JenkinsSmiHash.finish(hash); | |
| 10044 } | |
| 10045 } | |
| 10046 | 9859 |
| 10047 /** | 9860 /** |
| 10048 * rename feedback | 9861 * rename feedback |
| 10049 * | 9862 * |
| 10050 * { | 9863 * { |
| 10051 * "offset": int | 9864 * "offset": int |
| 10052 * "length": int | 9865 * "length": int |
| 10053 * "elementKindName": String | 9866 * "elementKindName": String |
| 10054 * "oldName": String | 9867 * "oldName": String |
| 10055 * } | 9868 * } |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10201 return false; | 10014 return false; |
| 10202 } | 10015 } |
| 10203 | 10016 |
| 10204 @override | 10017 @override |
| 10205 int get hashCode { | 10018 int get hashCode { |
| 10206 int hash = 0; | 10019 int hash = 0; |
| 10207 hash = _JenkinsSmiHash.combine(hash, newName.hashCode); | 10020 hash = _JenkinsSmiHash.combine(hash, newName.hashCode); |
| 10208 return _JenkinsSmiHash.finish(hash); | 10021 return _JenkinsSmiHash.finish(hash); |
| 10209 } | 10022 } |
| 10210 } | 10023 } |
| OLD | NEW |