| 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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 * | 278 * |
| 279 * @param property the property whose value is to be returned | 279 * @param property the property whose value is to be returned |
| 280 * @param value the new value of the given property | 280 * @param value the new value of the given property |
| 281 */ | 281 */ |
| 282 void setProperty(ErrorProperty property, Object value) { | 282 void setProperty(ErrorProperty property, Object value) { |
| 283 _propertyMap[property] = value; | 283 _propertyMap[property] = value; |
| 284 } | 284 } |
| 285 } | 285 } |
| 286 | 286 |
| 287 /** | 287 /** |
| 288 * The enumeration `AngularCode` defines Angular specific problems. | |
| 289 */ | |
| 290 class AngularCode extends ErrorCode { | |
| 291 static const AngularCode CANNOT_PARSE_SELECTOR = const AngularCode( | |
| 292 'CANNOT_PARSE_SELECTOR', | |
| 293 "The selector '{0}' cannot be parsed"); | |
| 294 | |
| 295 static const AngularCode INVALID_FORMATTER_NAME = const AngularCode( | |
| 296 'INVALID_FORMATTER_NAME', | |
| 297 "Formatter name must be a simple identifier"); | |
| 298 | |
| 299 static const AngularCode INVALID_PROPERTY_KIND = const AngularCode( | |
| 300 'INVALID_PROPERTY_KIND', | |
| 301 "Unknown property binding kind '{0}', use one of the '@', '=>', '=>!' or '
<=>'"); | |
| 302 | |
| 303 static const AngularCode INVALID_PROPERTY_FIELD = | |
| 304 const AngularCode('INVALID_PROPERTY_FIELD', "Unknown property field '{0}'"
); | |
| 305 | |
| 306 static const AngularCode INVALID_PROPERTY_MAP = const AngularCode( | |
| 307 'INVALID_PROPERTY_MAP', | |
| 308 "Argument 'map' must be a constant map literal"); | |
| 309 | |
| 310 static const AngularCode INVALID_PROPERTY_NAME = const AngularCode( | |
| 311 'INVALID_PROPERTY_NAME', | |
| 312 "Property name must be a string literal"); | |
| 313 | |
| 314 static const AngularCode INVALID_PROPERTY_SPEC = const AngularCode( | |
| 315 'INVALID_PROPERTY_SPEC', | |
| 316 "Property binding specification must be a string literal"); | |
| 317 | |
| 318 static const AngularCode INVALID_REPEAT_SYNTAX = const AngularCode( | |
| 319 'INVALID_REPEAT_SYNTAX', | |
| 320 "Expected statement in form '_item_ in _collection_ [tracked by _id_]'"); | |
| 321 | |
| 322 static const AngularCode INVALID_REPEAT_ITEM_SYNTAX = const AngularCode( | |
| 323 'INVALID_REPEAT_ITEM_SYNTAX', | |
| 324 "Item must by identifier or in '(_key_, _value_)' pair."); | |
| 325 | |
| 326 static const AngularCode INVALID_URI = | |
| 327 const AngularCode('INVALID_URI', "Invalid URI syntax: '{0}'"); | |
| 328 | |
| 329 static const AngularCode MISSING_FORMATTER_COLON = const AngularCode( | |
| 330 'MISSING_FORMATTER_COLON', | |
| 331 "Missing ':' before formatter argument"); | |
| 332 | |
| 333 static const AngularCode MISSING_NAME = | |
| 334 const AngularCode('MISSING_NAME', "Argument 'name' must be provided"); | |
| 335 | |
| 336 static const AngularCode MISSING_PUBLISH_AS = const AngularCode( | |
| 337 'MISSING_PUBLISH_AS', | |
| 338 "Argument 'publishAs' must be provided"); | |
| 339 | |
| 340 static const AngularCode MISSING_SELECTOR = | |
| 341 const AngularCode('MISSING_SELECTOR', "Argument 'selector' must be provide
d"); | |
| 342 | |
| 343 static const AngularCode URI_DOES_NOT_EXIST = | |
| 344 const AngularCode('URI_DOES_NOT_EXIST', "Target of URI does not exist: '{0
}'"); | |
| 345 | |
| 346 /** | |
| 347 * Initialize a newly created error code to have the given [name]. The message | |
| 348 * associated with the error will be created from the given [message] | |
| 349 * template. The correction associated with the error will be created from the | |
| 350 * given [correction] template. | |
| 351 */ | |
| 352 const AngularCode(String name, String message, [String correction]) | |
| 353 : super(name, message, correction); | |
| 354 | |
| 355 @override | |
| 356 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; | |
| 357 | |
| 358 @override | |
| 359 ErrorType get type => ErrorType.ANGULAR; | |
| 360 } | |
| 361 | |
| 362 /** | |
| 363 * Instances of the class `BooleanErrorListener` implement a listener that keeps
track of | 288 * Instances of the class `BooleanErrorListener` implement a listener that keeps
track of |
| 364 * whether an error has been reported to it. | 289 * whether an error has been reported to it. |
| 365 */ | 290 */ |
| 366 class BooleanErrorListener implements AnalysisErrorListener { | 291 class BooleanErrorListener implements AnalysisErrorListener { |
| 367 /** | 292 /** |
| 368 * A flag indicating whether an error has been reported to this listener. | 293 * A flag indicating whether an error has been reported to this listener. |
| 369 */ | 294 */ |
| 370 bool _errorReported = false; | 295 bool _errorReported = false; |
| 371 | 296 |
| 372 /** | 297 /** |
| (...skipping 2528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2901 static const ErrorType STATIC_TYPE_WARNING = | 2826 static const ErrorType STATIC_TYPE_WARNING = |
| 2902 const ErrorType('STATIC_TYPE_WARNING', 5, ErrorSeverity.WARNING); | 2827 const ErrorType('STATIC_TYPE_WARNING', 5, ErrorSeverity.WARNING); |
| 2903 | 2828 |
| 2904 /** | 2829 /** |
| 2905 * Syntactic errors are errors produced as a result of input that does not con
form to the grammar. | 2830 * Syntactic errors are errors produced as a result of input that does not con
form to the grammar. |
| 2906 */ | 2831 */ |
| 2907 static const ErrorType SYNTACTIC_ERROR = | 2832 static const ErrorType SYNTACTIC_ERROR = |
| 2908 const ErrorType('SYNTACTIC_ERROR', 6, ErrorSeverity.ERROR); | 2833 const ErrorType('SYNTACTIC_ERROR', 6, ErrorSeverity.ERROR); |
| 2909 | 2834 |
| 2910 /** | 2835 /** |
| 2911 * Angular specific semantic problems. | |
| 2912 */ | |
| 2913 static const ErrorType ANGULAR = | |
| 2914 const ErrorType('ANGULAR', 7, ErrorSeverity.INFO); | |
| 2915 | |
| 2916 /** | |
| 2917 * Polymer specific semantic problems. | 2836 * Polymer specific semantic problems. |
| 2918 */ | 2837 */ |
| 2919 static const ErrorType POLYMER = | 2838 static const ErrorType POLYMER = |
| 2920 const ErrorType('POLYMER', 8, ErrorSeverity.INFO); | 2839 const ErrorType('POLYMER', 7, ErrorSeverity.INFO); |
| 2921 | 2840 |
| 2922 static const List<ErrorType> values = const [ | 2841 static const List<ErrorType> values = const [ |
| 2923 TODO, | 2842 TODO, |
| 2924 HINT, | 2843 HINT, |
| 2925 COMPILE_TIME_ERROR, | 2844 COMPILE_TIME_ERROR, |
| 2926 CHECKED_MODE_COMPILE_TIME_ERROR, | 2845 CHECKED_MODE_COMPILE_TIME_ERROR, |
| 2927 STATIC_WARNING, | 2846 STATIC_WARNING, |
| 2928 STATIC_TYPE_WARNING, | 2847 STATIC_TYPE_WARNING, |
| 2929 SYNTACTIC_ERROR, | 2848 SYNTACTIC_ERROR, |
| 2930 ANGULAR, | |
| 2931 POLYMER]; | 2849 POLYMER]; |
| 2932 | 2850 |
| 2933 /** | 2851 /** |
| 2934 * The severity of this type of error. | 2852 * The severity of this type of error. |
| 2935 */ | 2853 */ |
| 2936 final ErrorSeverity severity; | 2854 final ErrorSeverity severity; |
| 2937 | 2855 |
| 2938 /** | 2856 /** |
| 2939 * Initialize a newly created error type to have the given severity. | 2857 * Initialize a newly created error type to have the given severity. |
| 2940 * | 2858 * |
| (...skipping 2149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5090 * Initialize a newly created error code to have the given [name]. | 5008 * Initialize a newly created error code to have the given [name]. |
| 5091 */ | 5009 */ |
| 5092 const TodoCode(String name) : super(name, "{0}"); | 5010 const TodoCode(String name) : super(name, "{0}"); |
| 5093 | 5011 |
| 5094 @override | 5012 @override |
| 5095 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; | 5013 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; |
| 5096 | 5014 |
| 5097 @override | 5015 @override |
| 5098 ErrorType get type => ErrorType.TODO; | 5016 ErrorType get type => ErrorType.TODO; |
| 5099 } | 5017 } |
| OLD | NEW |