| 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/spec/generate_files". | 7 // "pkg/analysis_server/spec/generate_files". |
| 8 | 8 |
| 9 part of protocol2; | 9 part of protocol2; |
| 10 | 10 |
| (...skipping 3994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4005 String correction; | 4005 String correction; |
| 4006 if (json.containsKey("correction")) { | 4006 if (json.containsKey("correction")) { |
| 4007 correction = jsonDecoder._decodeString(jsonPath + ".correction", json["c
orrection"]); | 4007 correction = jsonDecoder._decodeString(jsonPath + ".correction", json["c
orrection"]); |
| 4008 } | 4008 } |
| 4009 return new AnalysisError(severity, type, location, message, correction: co
rrection); | 4009 return new AnalysisError(severity, type, location, message, correction: co
rrection); |
| 4010 } else { | 4010 } else { |
| 4011 throw jsonDecoder.mismatch(jsonPath, "AnalysisError"); | 4011 throw jsonDecoder.mismatch(jsonPath, "AnalysisError"); |
| 4012 } | 4012 } |
| 4013 } | 4013 } |
| 4014 | 4014 |
| 4015 /** |
| 4016 * Construct based on error information from the analyzer engine. |
| 4017 */ |
| 4018 factory AnalysisError.fromEngine(engine.LineInfo lineInfo, engine.AnalysisErro
r error) => |
| 4019 _analysisErrorFromEngine(lineInfo, error); |
| 4020 |
| 4015 Map<String, dynamic> toJson() { | 4021 Map<String, dynamic> toJson() { |
| 4016 Map<String, dynamic> result = {}; | 4022 Map<String, dynamic> result = {}; |
| 4017 result["severity"] = severity.toJson(); | 4023 result["severity"] = severity.toJson(); |
| 4018 result["type"] = type.toJson(); | 4024 result["type"] = type.toJson(); |
| 4019 result["location"] = location.toJson(); | 4025 result["location"] = location.toJson(); |
| 4020 result["message"] = message; | 4026 result["message"] = message; |
| 4021 if (correction != null) { | 4027 if (correction != null) { |
| 4022 result["correction"] = correction; | 4028 result["correction"] = correction; |
| 4023 } | 4029 } |
| 4024 return result; | 4030 return result; |
| (...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4915 * { | 4921 * { |
| 4916 * "kind": ElementKind | 4922 * "kind": ElementKind |
| 4917 * "name": String | 4923 * "name": String |
| 4918 * "location": optional Location | 4924 * "location": optional Location |
| 4919 * "flags": int | 4925 * "flags": int |
| 4920 * "parameters": optional String | 4926 * "parameters": optional String |
| 4921 * "returnType": optional String | 4927 * "returnType": optional String |
| 4922 * } | 4928 * } |
| 4923 */ | 4929 */ |
| 4924 class Element implements HasToJson { | 4930 class Element implements HasToJson { |
| 4931 static const int FLAG_ABSTRACT = 0x01; |
| 4932 static const int FLAG_CONST = 0x02; |
| 4933 static const int FLAG_FINAL = 0x04; |
| 4934 static const int FLAG_STATIC = 0x08; |
| 4935 static const int FLAG_PRIVATE = 0x10; |
| 4936 static const int FLAG_DEPRECATED = 0x20; |
| 4937 |
| 4938 static int makeFlags({isAbstract: false, isConst: false, isFinal: false, isSta
tic: false, isPrivate: false, isDeprecated: false}) { |
| 4939 int flags = 0; |
| 4940 if (isAbstract) flags |= FLAG_ABSTRACT; |
| 4941 if (isConst) flags |= FLAG_CONST; |
| 4942 if (isFinal) flags |= FLAG_FINAL; |
| 4943 if (isStatic) flags |= FLAG_STATIC; |
| 4944 if (isPrivate) flags |= FLAG_PRIVATE; |
| 4945 if (isDeprecated) flags |= FLAG_DEPRECATED; |
| 4946 return flags; |
| 4947 } |
| 4948 |
| 4925 /** | 4949 /** |
| 4926 * The kind of the element. | 4950 * The kind of the element. |
| 4927 */ | 4951 */ |
| 4928 ElementKind kind; | 4952 ElementKind kind; |
| 4929 | 4953 |
| 4930 /** | 4954 /** |
| 4931 * The name of the element. This is typically used as the label in the | 4955 * The name of the element. This is typically used as the label in the |
| 4932 * outline. | 4956 * outline. |
| 4933 */ | 4957 */ |
| 4934 String name; | 4958 String name; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5001 String returnType; | 5025 String returnType; |
| 5002 if (json.containsKey("returnType")) { | 5026 if (json.containsKey("returnType")) { |
| 5003 returnType = jsonDecoder._decodeString(jsonPath + ".returnType", json["r
eturnType"]); | 5027 returnType = jsonDecoder._decodeString(jsonPath + ".returnType", json["r
eturnType"]); |
| 5004 } | 5028 } |
| 5005 return new Element(kind, name, flags, location: location, parameters: para
meters, returnType: returnType); | 5029 return new Element(kind, name, flags, location: location, parameters: para
meters, returnType: returnType); |
| 5006 } else { | 5030 } else { |
| 5007 throw jsonDecoder.mismatch(jsonPath, "Element"); | 5031 throw jsonDecoder.mismatch(jsonPath, "Element"); |
| 5008 } | 5032 } |
| 5009 } | 5033 } |
| 5010 | 5034 |
| 5035 bool get isAbstract => (flags & FLAG_ABSTRACT) != 0; |
| 5036 bool get isConst => (flags & FLAG_CONST) != 0; |
| 5037 bool get isFinal => (flags & FLAG_FINAL) != 0; |
| 5038 bool get isStatic => (flags & FLAG_STATIC) != 0; |
| 5039 bool get isPrivate => (flags & FLAG_PRIVATE) != 0; |
| 5040 bool get isDeprecated => (flags & FLAG_DEPRECATED) != 0; |
| 5041 |
| 5011 Map<String, dynamic> toJson() { | 5042 Map<String, dynamic> toJson() { |
| 5012 Map<String, dynamic> result = {}; | 5043 Map<String, dynamic> result = {}; |
| 5013 result["kind"] = kind.toJson(); | 5044 result["kind"] = kind.toJson(); |
| 5014 result["name"] = name; | 5045 result["name"] = name; |
| 5015 if (location != null) { | 5046 if (location != null) { |
| 5016 result["location"] = location.toJson(); | 5047 result["location"] = location.toJson(); |
| 5017 } | 5048 } |
| 5018 result["flags"] = flags; | 5049 result["flags"] = flags; |
| 5019 if (parameters != null) { | 5050 if (parameters != null) { |
| 5020 result["parameters"] = parameters; | 5051 result["parameters"] = parameters; |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5165 if (json is String) { | 5196 if (json is String) { |
| 5166 try { | 5197 try { |
| 5167 return new ElementKind(json); | 5198 return new ElementKind(json); |
| 5168 } catch(_) { | 5199 } catch(_) { |
| 5169 // Fall through | 5200 // Fall through |
| 5170 } | 5201 } |
| 5171 } | 5202 } |
| 5172 throw jsonDecoder.mismatch(jsonPath, "ElementKind"); | 5203 throw jsonDecoder.mismatch(jsonPath, "ElementKind"); |
| 5173 } | 5204 } |
| 5174 | 5205 |
| 5206 /** |
| 5207 * Construct based on a value from the analyzer engine. |
| 5208 */ |
| 5209 factory ElementKind.fromEngine(engine.ElementKind kind) => |
| 5210 _elementKindFromEngine(kind); |
| 5211 |
| 5175 @override | 5212 @override |
| 5176 String toString() => "ElementKind.$name"; | 5213 String toString() => "ElementKind.$name"; |
| 5177 | 5214 |
| 5178 String toJson() => name; | 5215 String toJson() => name; |
| 5179 } | 5216 } |
| 5180 | 5217 |
| 5181 /** | 5218 /** |
| 5182 * Error | 5219 * Error |
| 5183 * | 5220 * |
| 5184 * { | 5221 * { |
| (...skipping 2675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7860 * | 7897 * |
| 7861 * { | 7898 * { |
| 7862 * "offset": int | 7899 * "offset": int |
| 7863 * "length": int | 7900 * "length": int |
| 7864 * "replacement": String | 7901 * "replacement": String |
| 7865 * "id": optional String | 7902 * "id": optional String |
| 7866 * } | 7903 * } |
| 7867 */ | 7904 */ |
| 7868 class SourceEdit implements HasToJson { | 7905 class SourceEdit implements HasToJson { |
| 7869 /** | 7906 /** |
| 7907 * Get the result of applying a set of [edits] to the given [code]. Edits are |
| 7908 * applied in the order they appear in [edits]. |
| 7909 */ |
| 7910 static String applySequence(String code, Iterable<SourceEdit> edits) => |
| 7911 _applySequence(code, edits); |
| 7912 |
| 7913 /** |
| 7870 * The offset of the region to be modified. | 7914 * The offset of the region to be modified. |
| 7871 */ | 7915 */ |
| 7872 int offset; | 7916 int offset; |
| 7873 | 7917 |
| 7874 /** | 7918 /** |
| 7875 * The length of the region to be modified. | 7919 * The length of the region to be modified. |
| 7876 */ | 7920 */ |
| 7877 int length; | 7921 int length; |
| 7878 | 7922 |
| 7879 /** | 7923 /** |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7921 String id; | 7965 String id; |
| 7922 if (json.containsKey("id")) { | 7966 if (json.containsKey("id")) { |
| 7923 id = jsonDecoder._decodeString(jsonPath + ".id", json["id"]); | 7967 id = jsonDecoder._decodeString(jsonPath + ".id", json["id"]); |
| 7924 } | 7968 } |
| 7925 return new SourceEdit(offset, length, replacement, id: id); | 7969 return new SourceEdit(offset, length, replacement, id: id); |
| 7926 } else { | 7970 } else { |
| 7927 throw jsonDecoder.mismatch(jsonPath, "SourceEdit"); | 7971 throw jsonDecoder.mismatch(jsonPath, "SourceEdit"); |
| 7928 } | 7972 } |
| 7929 } | 7973 } |
| 7930 | 7974 |
| 7975 /** |
| 7976 * Construct based on a SourceRange. |
| 7977 */ |
| 7978 SourceEdit.range(engine.SourceRange range, String replacement, {String id}) |
| 7979 : this(range.offset, range.length, replacement, id: id); |
| 7980 |
| 7981 /** |
| 7982 * The end of the region to be modified. |
| 7983 */ |
| 7984 int get end => offset + length; |
| 7985 |
| 7931 Map<String, dynamic> toJson() { | 7986 Map<String, dynamic> toJson() { |
| 7932 Map<String, dynamic> result = {}; | 7987 Map<String, dynamic> result = {}; |
| 7933 result["offset"] = offset; | 7988 result["offset"] = offset; |
| 7934 result["length"] = length; | 7989 result["length"] = length; |
| 7935 result["replacement"] = replacement; | 7990 result["replacement"] = replacement; |
| 7936 if (id != null) { | 7991 if (id != null) { |
| 7937 result["id"] = id; | 7992 result["id"] = id; |
| 7938 } | 7993 } |
| 7939 return result; | 7994 return result; |
| 7940 } | 7995 } |
| 7941 | 7996 |
| 7997 /** |
| 7998 * Get the result of applying the edit to the given [code]. |
| 7999 */ |
| 8000 String apply(String code) => _applyEdit(code, this); |
| 8001 |
| 7942 @override | 8002 @override |
| 7943 String toString() => JSON.encode(toJson()); | 8003 String toString() => JSON.encode(toJson()); |
| 7944 | 8004 |
| 7945 @override | 8005 @override |
| 7946 bool operator==(other) { | 8006 bool operator==(other) { |
| 7947 if (other is SourceEdit) { | 8007 if (other is SourceEdit) { |
| 7948 return offset == other.offset && | 8008 return offset == other.offset && |
| 7949 length == other.length && | 8009 length == other.length && |
| 7950 replacement == other.replacement && | 8010 replacement == other.replacement && |
| 7951 id == other.id; | 8011 id == other.id; |
| (...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8902 return false; | 8962 return false; |
| 8903 } | 8963 } |
| 8904 | 8964 |
| 8905 @override | 8965 @override |
| 8906 int get hashCode { | 8966 int get hashCode { |
| 8907 int hash = 0; | 8967 int hash = 0; |
| 8908 hash = _JenkinsSmiHash.combine(hash, newName.hashCode); | 8968 hash = _JenkinsSmiHash.combine(hash, newName.hashCode); |
| 8909 return _JenkinsSmiHash.finish(hash); | 8969 return _JenkinsSmiHash.finish(hash); |
| 8910 } | 8970 } |
| 8911 } | 8971 } |
| OLD | NEW |