| 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.error.codes; | 5 library analyzer.src.error.codes; |
| 6 | 6 |
| 7 import 'package:analyzer/error/error.dart'; | 7 import 'package:analyzer/error/error.dart'; |
| 8 | 8 |
| 9 export 'package:analyzer/src/analysis_options/error/option_codes.dart'; | 9 export 'package:analyzer/src/analysis_options/error/option_codes.dart'; |
| 10 export 'package:analyzer/src/dart/error/hint_codes.dart'; | 10 export 'package:analyzer/src/dart/error/hint_codes.dart'; |
| (...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 * where e, e1 and e2 are constant expressions that evaluate to a numeric | 633 * where e, e1 and e2 are constant expressions that evaluate to a numeric |
| 634 * value or to null. | 634 * value or to null. |
| 635 */ | 635 */ |
| 636 static const CompileTimeErrorCode CONST_EVAL_TYPE_NUM = | 636 static const CompileTimeErrorCode CONST_EVAL_TYPE_NUM = |
| 637 const CompileTimeErrorCode( | 637 const CompileTimeErrorCode( |
| 638 'CONST_EVAL_TYPE_NUM', | 638 'CONST_EVAL_TYPE_NUM', |
| 639 "In constant expressions, operands of this operator must be of type " | 639 "In constant expressions, operands of this operator must be of type " |
| 640 "'num'."); | 640 "'num'."); |
| 641 | 641 |
| 642 /** | 642 /** |
| 643 * https://github.com/dart-lang/sdk/blob/master/docs/language/informal/assert-
in-initializer-list.md |
| 644 * |
| 645 * During a const constructor invocation (that is, when the `const` |
| 646 * constructor is invoked using the const prefix), if the assert fails, |
| 647 * either due to boolean conversion when `r` is not a boolean value or due to |
| 648 * assertion failure when `r` is `false`, it is treated like any other |
| 649 * compile-time throw in a compile-time constant expression, and it causes |
| 650 * a compile-time error. |
| 651 */ |
| 652 static const CompileTimeErrorCode CONST_EVAL_THROWS_ASSERT_NOT_BOOL = |
| 653 const CompileTimeErrorCode( |
| 654 'CONST_EVAL_THROWS_ASSERT_NOT_BOOL', |
| 655 "In constant constructors the value of the condition of an assert " |
| 656 "statement must be bool."); |
| 657 |
| 658 /** |
| 659 * https://github.com/dart-lang/sdk/blob/master/docs/language/informal/assert-
in-initializer-list.md |
| 660 * |
| 661 * During a const constructor invocation (that is, when the `const` |
| 662 * constructor is invoked using the const prefix), if the assert fails, |
| 663 * either due to boolean conversion when `r` is not a boolean value or due to |
| 664 * assertion failure when `r` is `false`, it is treated like any other |
| 665 * compile-time throw in a compile-time constant expression, and it causes |
| 666 * a compile-time error. |
| 667 */ |
| 668 static const CompileTimeErrorCode CONST_EVAL_THROWS_ASSERT_FALSE = |
| 669 const CompileTimeErrorCode('CONST_EVAL_THROWS_ASSERT_FALSE', |
| 670 "Evaluation of this constant expression throws an AssertionError."); |
| 671 |
| 672 /** |
| 643 * 16.12.2 Const: It is a compile-time error if evaluation of a constant | 673 * 16.12.2 Const: It is a compile-time error if evaluation of a constant |
| 644 * object results in an uncaught exception being thrown. | 674 * object results in an uncaught exception being thrown. |
| 645 */ | 675 */ |
| 646 static const CompileTimeErrorCode CONST_EVAL_THROWS_EXCEPTION = | 676 static const CompileTimeErrorCode CONST_EVAL_THROWS_EXCEPTION = |
| 647 const CompileTimeErrorCode('CONST_EVAL_THROWS_EXCEPTION', | 677 const CompileTimeErrorCode('CONST_EVAL_THROWS_EXCEPTION', |
| 648 "Evaluation of this constant expression throws an exception."); | 678 "Evaluation of this constant expression throws an exception."); |
| 649 | 679 |
| 650 /** | 680 /** |
| 651 * 16.12.2 Const: It is a compile-time error if evaluation of a constant | 681 * 16.12.2 Const: It is a compile-time error if evaluation of a constant |
| 652 * object results in an uncaught exception being thrown. | 682 * object results in an uncaught exception being thrown. |
| (...skipping 4402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5055 * created from the optional [correction] template. | 5085 * created from the optional [correction] template. |
| 5056 */ | 5086 */ |
| 5057 const StrongModeCode(ErrorType type, String name, String message, | 5087 const StrongModeCode(ErrorType type, String name, String message, |
| 5058 [String correction]) | 5088 [String correction]) |
| 5059 : type = type, | 5089 : type = type, |
| 5060 super('STRONG_MODE_$name', message, correction); | 5090 super('STRONG_MODE_$name', message, correction); |
| 5061 | 5091 |
| 5062 @override | 5092 @override |
| 5063 ErrorSeverity get errorSeverity => type.severity; | 5093 ErrorSeverity get errorSeverity => type.severity; |
| 5064 } | 5094 } |
| OLD | NEW |