| 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 analyzer.src.generated.error; | 5 library analyzer.src.generated.error; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart' show AstNode; | 9 import 'package:analyzer/dart/ast/ast.dart' show AstNode; |
| 10 import 'package:analyzer/dart/ast/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 return false; | 170 return false; |
| 171 } | 171 } |
| 172 // OK | 172 // OK |
| 173 return true; | 173 return true; |
| 174 } | 174 } |
| 175 | 175 |
| 176 /** | 176 /** |
| 177 * Return the value of the given [property], or `null` if the given property | 177 * Return the value of the given [property], or `null` if the given property |
| 178 * is not defined for this error. | 178 * is not defined for this error. |
| 179 */ | 179 */ |
| 180 Object getProperty(ErrorProperty property) => null; | 180 Object/*=V*/ getProperty/*<V>*/(ErrorProperty/*<V>*/ property) => null; |
| 181 | 181 |
| 182 @override | 182 @override |
| 183 String toString() { | 183 String toString() { |
| 184 StringBuffer buffer = new StringBuffer(); | 184 StringBuffer buffer = new StringBuffer(); |
| 185 buffer.write((source != null) ? source.fullName : "<unknown source>"); | 185 buffer.write((source != null) ? source.fullName : "<unknown source>"); |
| 186 buffer.write("("); | 186 buffer.write("("); |
| 187 buffer.write(offset); | 187 buffer.write(offset); |
| 188 buffer.write(".."); | 188 buffer.write(".."); |
| 189 buffer.write(offset + length - 1); | 189 buffer.write(offset + length - 1); |
| 190 buffer.write("): "); | 190 buffer.write("): "); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 * given [source] and is located at the given [offset] with the given | 249 * given [source] and is located at the given [offset] with the given |
| 250 * [length]. The error will have the given [errorCode] and the list of | 250 * [length]. The error will have the given [errorCode] and the list of |
| 251 * [arguments] will be used to complete the message. | 251 * [arguments] will be used to complete the message. |
| 252 */ | 252 */ |
| 253 AnalysisErrorWithProperties( | 253 AnalysisErrorWithProperties( |
| 254 Source source, int offset, int length, ErrorCode errorCode, | 254 Source source, int offset, int length, ErrorCode errorCode, |
| 255 [List<Object> arguments]) | 255 [List<Object> arguments]) |
| 256 : super(source, offset, length, errorCode, arguments); | 256 : super(source, offset, length, errorCode, arguments); |
| 257 | 257 |
| 258 @override | 258 @override |
| 259 Object getProperty(ErrorProperty property) => _propertyMap[property]; | 259 Object/*=V*/ getProperty/*<V>*/(ErrorProperty/*<V>*/ property) => |
| 260 _propertyMap[property] as Object/*=V*/; |
| 260 | 261 |
| 261 /** | 262 /** |
| 262 * Set the value of the given [property] to the given [value]. Using a value | 263 * Set the value of the given [property] to the given [value]. Using a value |
| 263 * of `null` will effectively remove the property from this error. | 264 * of `null` will effectively remove the property from this error. |
| 264 */ | 265 */ |
| 265 void setProperty(ErrorProperty property, Object value) { | 266 void setProperty/*<V>*/(ErrorProperty/*<V>*/ property, Object/*=V*/ value) { |
| 266 _propertyMap[property] = value; | 267 _propertyMap[property] = value; |
| 267 } | 268 } |
| 268 } | 269 } |
| 269 | 270 |
| 270 /** | 271 /** |
| 271 * The error codes used for errors in analysis options files. The convention for | 272 * The error codes used for errors in analysis options files. The convention for |
| 272 * this class is for the name of the error code to indicate the problem that | 273 * this class is for the name of the error code to indicate the problem that |
| 273 * caused the error to be generated and for the error message to explain what is | 274 * caused the error to be generated and for the error message to explain what is |
| 274 * wrong and, when appropriate, how the problem can be corrected. | 275 * wrong and, when appropriate, how the problem can be corrected. |
| 275 */ | 276 */ |
| (...skipping 2785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3061 */ | 3062 */ |
| 3062 String get uniqueName => "$runtimeType.$name"; | 3063 String get uniqueName => "$runtimeType.$name"; |
| 3063 | 3064 |
| 3064 @override | 3065 @override |
| 3065 String toString() => uniqueName; | 3066 String toString() => uniqueName; |
| 3066 } | 3067 } |
| 3067 | 3068 |
| 3068 /** | 3069 /** |
| 3069 * The properties that can be associated with an [AnalysisError]. | 3070 * The properties that can be associated with an [AnalysisError]. |
| 3070 */ | 3071 */ |
| 3071 class ErrorProperty extends Enum<ErrorProperty> { | 3072 class ErrorProperty<V> extends Enum<ErrorProperty> { |
| 3072 /** | 3073 /** |
| 3073 * A property whose value is a list of [FieldElement]s that are final, but | 3074 * A property whose value is a list of [FieldElement]s that are final, but |
| 3074 * not initialized by a constructor. | 3075 * not initialized by a constructor. |
| 3075 */ | 3076 */ |
| 3076 static const ErrorProperty NOT_INITIALIZED_FIELDS = | 3077 static const ErrorProperty<List<FieldElement>> NOT_INITIALIZED_FIELDS = |
| 3077 const ErrorProperty('NOT_INITIALIZED_FIELDS', 0); | 3078 const ErrorProperty<List<FieldElement>>('NOT_INITIALIZED_FIELDS', 0); |
| 3078 | 3079 |
| 3079 /** | 3080 /** |
| 3080 * A property whose value is the name of the library that is used by all | 3081 * A property whose value is the name of the library that is used by all |
| 3081 * of the "part of" directives, so should be used in the "library" directive. | 3082 * of the "part of" directives, so should be used in the "library" directive. |
| 3082 * Is `null` if there is no a single name used by all of the parts. | 3083 * Is `null` if there is no a single name used by all of the parts. |
| 3083 */ | 3084 */ |
| 3084 static const ErrorProperty PARTS_LIBRARY_NAME = | 3085 static const ErrorProperty<String> PARTS_LIBRARY_NAME = |
| 3085 const ErrorProperty('PARTS_LIBRARY_NAME', 1); | 3086 const ErrorProperty<String>('PARTS_LIBRARY_NAME', 1); |
| 3086 | 3087 |
| 3087 /** | 3088 /** |
| 3088 * A property whose value is a list of [ExecutableElement] that should | 3089 * A property whose value is a list of [ExecutableElement] that should |
| 3089 * be but are not implemented by a concrete class. | 3090 * be but are not implemented by a concrete class. |
| 3090 */ | 3091 */ |
| 3091 static const ErrorProperty UNIMPLEMENTED_METHODS = | 3092 static const ErrorProperty<List<ExecutableElement>> UNIMPLEMENTED_METHODS = |
| 3092 const ErrorProperty('UNIMPLEMENTED_METHODS', 2); | 3093 const ErrorProperty<List<ExecutableElement>>('UNIMPLEMENTED_METHODS', 2); |
| 3093 | 3094 |
| 3094 static const List<ErrorProperty> values = const [ | 3095 static const List<ErrorProperty> values = const [ |
| 3095 NOT_INITIALIZED_FIELDS, | 3096 NOT_INITIALIZED_FIELDS, |
| 3096 PARTS_LIBRARY_NAME, | 3097 PARTS_LIBRARY_NAME, |
| 3097 UNIMPLEMENTED_METHODS | 3098 UNIMPLEMENTED_METHODS |
| 3098 ]; | 3099 ]; |
| 3099 | 3100 |
| 3100 const ErrorProperty(String name, int ordinal) : super(name, ordinal); | 3101 const ErrorProperty(String name, int ordinal) : super(name, ordinal); |
| 3101 } | 3102 } |
| 3102 | 3103 |
| (...skipping 2644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5747 * Initialize a newly created error code to have the given [name]. | 5748 * Initialize a newly created error code to have the given [name]. |
| 5748 */ | 5749 */ |
| 5749 const TodoCode(String name) : super(name, "{0}"); | 5750 const TodoCode(String name) : super(name, "{0}"); |
| 5750 | 5751 |
| 5751 @override | 5752 @override |
| 5752 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; | 5753 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; |
| 5753 | 5754 |
| 5754 @override | 5755 @override |
| 5755 ErrorType get type => ErrorType.TODO; | 5756 ErrorType get type => ErrorType.TODO; |
| 5756 } | 5757 } |
| OLD | NEW |