Chromium Code Reviews| 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 engine.error; | 5 library engine.error; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'ast.dart' show AstNode; | 9 import 'ast.dart' show AstNode; |
| 10 import 'element.dart'; | 10 import 'element.dart'; |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 230 */ | 230 */ |
| 231 HashMap<ErrorProperty, Object> _propertyMap = | 231 HashMap<ErrorProperty, Object> _propertyMap = |
| 232 new HashMap<ErrorProperty, Object>(); | 232 new HashMap<ErrorProperty, Object>(); |
| 233 | 233 |
| 234 /** | 234 /** |
| 235 * Initialize a newly created analysis error for the specified [source]. The | 235 * Initialize a newly created analysis error for the specified [source]. The |
| 236 * error will have the given [errorCode] and the list of [arguments] will be | 236 * error will have the given [errorCode] and the list of [arguments] will be |
| 237 * used to complete the message. The error has no location information. | 237 * used to complete the message. The error has no location information. |
| 238 */ | 238 */ |
| 239 AnalysisErrorWithProperties.con1( | 239 AnalysisErrorWithProperties.con1( |
| 240 Source source, ErrorCode errorCode, List<Object> arguments) | 240 Source source, ErrorCode errorCode, [List<Object> arguments]) |
| 241 : super.con1(source, errorCode, arguments); | 241 : super.con1(source, errorCode, arguments); |
| 242 | 242 |
| 243 /** | 243 /** |
| 244 * Initialize a newly created analysis error for the specified [source] at the | 244 * Initialize a newly created analysis error for the specified [source] at the |
| 245 * given [offset] with the given [length]. The error will have the given | 245 * given [offset] with the given [length]. The error will have the given |
| 246 * [errorCode] and the list of [arguments] will be used to complete the | 246 * [errorCode] and the list of [arguments] will be used to complete the |
| 247 * message. | 247 * message. |
| 248 */ | 248 */ |
| 249 AnalysisErrorWithProperties.con2(Source source, int offset, int length, | 249 AnalysisErrorWithProperties.con2(Source source, int offset, int length, |
| 250 ErrorCode errorCode, List<Object> arguments) | 250 ErrorCode errorCode, List<Object> arguments) |
|
Brian Wilkerson
2015/03/15 23:28:14
Make 'arguments' optional here too?
scheglov
2015/03/15 23:38:15
Done.
| |
| 251 : super.con2(source, offset, length, errorCode, arguments); | 251 : super.con2(source, offset, length, errorCode, arguments); |
| 252 | 252 |
| 253 @override | 253 @override |
| 254 Object getProperty(ErrorProperty property) => _propertyMap[property]; | 254 Object getProperty(ErrorProperty property) => _propertyMap[property]; |
| 255 | 255 |
| 256 /** | 256 /** |
| 257 * Set the value of the given [property] to the given [value]. Using a value | 257 * Set the value of the given [property] to the given [value]. Using a value |
| 258 * of `null` will effectively remove the property from this error. | 258 * of `null` will effectively remove the property from this error. |
| 259 */ | 259 */ |
| 260 void setProperty(ErrorProperty property, Object value) { | 260 void setProperty(ErrorProperty property, Object value) { |
| (...skipping 2109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2370 * The unique name of this error code. | 2370 * The unique name of this error code. |
| 2371 */ | 2371 */ |
| 2372 String get uniqueName => "$runtimeType.$name"; | 2372 String get uniqueName => "$runtimeType.$name"; |
| 2373 } | 2373 } |
| 2374 | 2374 |
| 2375 /** | 2375 /** |
| 2376 * The properties that can be associated with an [AnalysisError]. | 2376 * The properties that can be associated with an [AnalysisError]. |
| 2377 */ | 2377 */ |
| 2378 class ErrorProperty extends Enum<ErrorProperty> { | 2378 class ErrorProperty extends Enum<ErrorProperty> { |
| 2379 /** | 2379 /** |
| 2380 * A property whose value is an array of [ExecutableElement] that should | 2380 * A property whose value is the name of the library that is used by all |
| 2381 * of the "part of" directives, so should be used in the "library" directive. | |
| 2382 * Is `null` if there is no a single name used by all of the parts. | |
| 2383 */ | |
| 2384 static const ErrorProperty PARTS_LIBRARY_NAME = | |
| 2385 const ErrorProperty('PARTS_LIBRARY_NAME', 0); | |
| 2386 | |
| 2387 /** | |
| 2388 * A property whose value is a list of [ExecutableElement] that should | |
| 2381 * be but are not implemented by a concrete class. | 2389 * be but are not implemented by a concrete class. |
| 2382 */ | 2390 */ |
| 2383 static const ErrorProperty UNIMPLEMENTED_METHODS = | 2391 static const ErrorProperty UNIMPLEMENTED_METHODS = |
| 2384 const ErrorProperty('UNIMPLEMENTED_METHODS', 0); | 2392 const ErrorProperty('UNIMPLEMENTED_METHODS', 1); |
| 2385 | 2393 |
| 2386 static const List<ErrorProperty> values = const [UNIMPLEMENTED_METHODS]; | 2394 static const List<ErrorProperty> values = const [ |
| 2395 PARTS_LIBRARY_NAME, | |
| 2396 UNIMPLEMENTED_METHODS | |
| 2397 ]; | |
| 2387 | 2398 |
| 2388 const ErrorProperty(String name, int ordinal) : super(name, ordinal); | 2399 const ErrorProperty(String name, int ordinal) : super(name, ordinal); |
| 2389 } | 2400 } |
| 2390 | 2401 |
| 2391 /** | 2402 /** |
| 2392 * An object used to create analysis errors and report then to an error | 2403 * An object used to create analysis errors and report then to an error |
| 2393 * listener. | 2404 * listener. |
| 2394 */ | 2405 */ |
| 2395 class ErrorReporter { | 2406 class ErrorReporter { |
| 2396 /** | 2407 /** |
| (...skipping 2400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4797 * Initialize a newly created error code to have the given [name]. | 4808 * Initialize a newly created error code to have the given [name]. |
| 4798 */ | 4809 */ |
| 4799 const TodoCode(String name) : super(name, "{0}"); | 4810 const TodoCode(String name) : super(name, "{0}"); |
| 4800 | 4811 |
| 4801 @override | 4812 @override |
| 4802 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; | 4813 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; |
| 4803 | 4814 |
| 4804 @override | 4815 @override |
| 4805 ErrorType get type => ErrorType.TODO; | 4816 ErrorType get type => ErrorType.TODO; |
| 4806 } | 4817 } |
| OLD | NEW |