| 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 2814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2825 */ | 2825 */ |
| 2826 static const ErrorType STATIC_TYPE_WARNING = | 2826 static const ErrorType STATIC_TYPE_WARNING = |
| 2827 const ErrorType('STATIC_TYPE_WARNING', 5, ErrorSeverity.WARNING); | 2827 const ErrorType('STATIC_TYPE_WARNING', 5, ErrorSeverity.WARNING); |
| 2828 | 2828 |
| 2829 /** | 2829 /** |
| 2830 * 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. |
| 2831 */ | 2831 */ |
| 2832 static const ErrorType SYNTACTIC_ERROR = | 2832 static const ErrorType SYNTACTIC_ERROR = |
| 2833 const ErrorType('SYNTACTIC_ERROR', 6, ErrorSeverity.ERROR); | 2833 const ErrorType('SYNTACTIC_ERROR', 6, ErrorSeverity.ERROR); |
| 2834 | 2834 |
| 2835 /** | |
| 2836 * Polymer specific semantic problems. | |
| 2837 */ | |
| 2838 static const ErrorType POLYMER = | |
| 2839 const ErrorType('POLYMER', 7, ErrorSeverity.INFO); | |
| 2840 | |
| 2841 static const List<ErrorType> values = const [ | 2835 static const List<ErrorType> values = const [ |
| 2842 TODO, | 2836 TODO, |
| 2843 HINT, | 2837 HINT, |
| 2844 COMPILE_TIME_ERROR, | 2838 COMPILE_TIME_ERROR, |
| 2845 CHECKED_MODE_COMPILE_TIME_ERROR, | 2839 CHECKED_MODE_COMPILE_TIME_ERROR, |
| 2846 STATIC_WARNING, | 2840 STATIC_WARNING, |
| 2847 STATIC_TYPE_WARNING, | 2841 STATIC_TYPE_WARNING, |
| 2848 SYNTACTIC_ERROR, | 2842 SYNTACTIC_ERROR]; |
| 2849 POLYMER]; | |
| 2850 | 2843 |
| 2851 /** | 2844 /** |
| 2852 * The severity of this type of error. | 2845 * The severity of this type of error. |
| 2853 */ | 2846 */ |
| 2854 final ErrorSeverity severity; | 2847 final ErrorSeverity severity; |
| 2855 | 2848 |
| 2856 /** | 2849 /** |
| 2857 * Initialize a newly created error type to have the given severity. | 2850 * Initialize a newly created error type to have the given severity. |
| 2858 * | 2851 * |
| 2859 * @param severity the severity of this type of error | 2852 * @param severity the severity of this type of error |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3229 : super(name, message, correction); | 3222 : super(name, message, correction); |
| 3230 | 3223 |
| 3231 @override | 3224 @override |
| 3232 ErrorSeverity get errorSeverity => ErrorSeverity.WARNING; | 3225 ErrorSeverity get errorSeverity => ErrorSeverity.WARNING; |
| 3233 | 3226 |
| 3234 @override | 3227 @override |
| 3235 ErrorType get type => ErrorType.STATIC_WARNING; | 3228 ErrorType get type => ErrorType.STATIC_WARNING; |
| 3236 } | 3229 } |
| 3237 | 3230 |
| 3238 /** | 3231 /** |
| 3239 * The enumeration `PolymerCode` defines Polymer specific problems. | |
| 3240 */ | |
| 3241 class PolymerCode extends ErrorCode { | |
| 3242 static const PolymerCode ATTRIBUTE_FIELD_NOT_PUBLISHED = const PolymerCode( | |
| 3243 'ATTRIBUTE_FIELD_NOT_PUBLISHED', | |
| 3244 "Field '{0}' in '{1}' must be @published"); | |
| 3245 | |
| 3246 static const PolymerCode DUPLICATE_ATTRIBUTE_DEFINITION = const PolymerCode( | |
| 3247 'DUPLICATE_ATTRIBUTE_DEFINITION', | |
| 3248 "The attribute '{0}' is already defined"); | |
| 3249 | |
| 3250 static const PolymerCode EMPTY_ATTRIBUTES = const PolymerCode( | |
| 3251 'EMPTY_ATTRIBUTES', | |
| 3252 "Empty 'attributes' attribute is useless"); | |
| 3253 | |
| 3254 static const PolymerCode INVALID_ATTRIBUTE_NAME = const PolymerCode( | |
| 3255 'INVALID_ATTRIBUTE_NAME', | |
| 3256 "'{0}' is not a valid name for a custom element attribute"); | |
| 3257 | |
| 3258 static const PolymerCode INVALID_TAG_NAME = const PolymerCode( | |
| 3259 'INVALID_TAG_NAME', | |
| 3260 "'{0}' is not a valid name for a custom element"); | |
| 3261 | |
| 3262 static const PolymerCode MISSING_TAG_NAME = const PolymerCode( | |
| 3263 'MISSING_TAG_NAME', | |
| 3264 "Missing tag name of the custom element. Please include an attribute like
name='your-tag-name'"); | |
| 3265 | |
| 3266 static const PolymerCode UNDEFINED_ATTRIBUTE_FIELD = const PolymerCode( | |
| 3267 'UNDEFINED_ATTRIBUTE_FIELD', | |
| 3268 "There is no such field '{0}' in '{1}'"); | |
| 3269 | |
| 3270 /** | |
| 3271 * Initialize a newly created error code to have the given [name]. The message | |
| 3272 * associated with the error will be created from the given [message] | |
| 3273 * template. The correction associated with the error will be created from the | |
| 3274 * given [correction] template. | |
| 3275 */ | |
| 3276 const PolymerCode(String name, String message, [String correction]) | |
| 3277 : super(name, message, correction); | |
| 3278 | |
| 3279 @override | |
| 3280 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; | |
| 3281 | |
| 3282 @override | |
| 3283 ErrorType get type => ErrorType.POLYMER; | |
| 3284 } | |
| 3285 | |
| 3286 /** | |
| 3287 * The class `StaticTypeWarningCode` defines the error codes used for static | 3232 * The class `StaticTypeWarningCode` defines the error codes used for static |
| 3288 * type warnings. The convention for this class is for the name of the error | 3233 * type warnings. The convention for this class is for the name of the error |
| 3289 * code to indicate the problem that caused the error to be generated and for | 3234 * code to indicate the problem that caused the error to be generated and for |
| 3290 * the error message to explain what is wrong and, when appropriate, how the | 3235 * the error message to explain what is wrong and, when appropriate, how the |
| 3291 * problem can be corrected. | 3236 * problem can be corrected. |
| 3292 */ | 3237 */ |
| 3293 class StaticTypeWarningCode extends ErrorCode { | 3238 class StaticTypeWarningCode extends ErrorCode { |
| 3294 /** | 3239 /** |
| 3295 * 12.7 Lists: A fresh instance (7.6.1) <i>a</i>, of size <i>n</i>, whose | 3240 * 12.7 Lists: A fresh instance (7.6.1) <i>a</i>, of size <i>n</i>, whose |
| 3296 * class implements the built-in class <i>List<E></i> is allocated. | 3241 * class implements the built-in class <i>List<E></i> is allocated. |
| (...skipping 1711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5008 * Initialize a newly created error code to have the given [name]. | 4953 * Initialize a newly created error code to have the given [name]. |
| 5009 */ | 4954 */ |
| 5010 const TodoCode(String name) : super(name, "{0}"); | 4955 const TodoCode(String name) : super(name, "{0}"); |
| 5011 | 4956 |
| 5012 @override | 4957 @override |
| 5013 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; | 4958 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; |
| 5014 | 4959 |
| 5015 @override | 4960 @override |
| 5016 ErrorType get type => ErrorType.TODO; | 4961 ErrorType get type => ErrorType.TODO; |
| 5017 } | 4962 } |
| OLD | NEW |