| 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/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
| 11 import 'package:analyzer/dart/element/type.dart'; | 11 import 'package:analyzer/dart/element/type.dart'; |
| 12 import 'package:analyzer/source/error_processor.dart'; | 12 import 'package:analyzer/source/error_processor.dart'; |
| 13 import 'package:analyzer/src/generated/java_core.dart'; | 13 import 'package:analyzer/src/generated/java_core.dart'; |
| 14 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode; | 14 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode; |
| 15 import 'package:analyzer/src/generated/scanner.dart' | 15 import 'package:analyzer/src/generated/scanner.dart' |
| 16 show ScannerErrorCode, Token; | 16 show ScannerErrorCode, Token; |
| 17 import 'package:analyzer/src/generated/source.dart'; | 17 import 'package:analyzer/src/generated/source.dart'; |
| 18 import 'package:analyzer/src/task/model.dart'; | 18 import 'package:analyzer/src/task/model.dart'; |
| 19 import 'package:analyzer/task/model.dart'; | 19 import 'package:analyzer/task/model.dart'; |
| 20 import 'package:source_span/source_span.dart'; | 20 import 'package:source_span/source_span.dart'; |
| 21 | 21 |
| 22 import 'generated/shared_messages.dart' as shared_messages; | |
| 23 | |
| 24 /** | 22 /** |
| 25 * The descriptor used to associate error processors with analysis contexts in | 23 * The descriptor used to associate error processors with analysis contexts in |
| 26 * configuration data. | 24 * configuration data. |
| 27 */ | 25 */ |
| 28 final ListResultDescriptor<List<ErrorProcessor>> CONFIGURED_ERROR_PROCESSORS = | 26 final ListResultDescriptor<List<ErrorProcessor>> CONFIGURED_ERROR_PROCESSORS = |
| 29 new ListResultDescriptorImpl('configured.errors', const <ErrorProcessor>[]); | 27 new ListResultDescriptorImpl('configured.errors', const <ErrorProcessor>[]); |
| 30 | 28 |
| 31 /** | 29 /** |
| 32 * An error discovered during the analysis of some Dart code. | 30 * An error discovered during the analysis of some Dart code. |
| 33 * | 31 * |
| (...skipping 1619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1653 "List literals must be prefixed with 'const' when used as a constant e
xpression"); | 1651 "List literals must be prefixed with 'const' when used as a constant e
xpression"); |
| 1654 | 1652 |
| 1655 /** | 1653 /** |
| 1656 * 12.1 Constants: A constant expression is ... a constant map literal. | 1654 * 12.1 Constants: A constant expression is ... a constant map literal. |
| 1657 */ | 1655 */ |
| 1658 static const CompileTimeErrorCode MISSING_CONST_IN_MAP_LITERAL = | 1656 static const CompileTimeErrorCode MISSING_CONST_IN_MAP_LITERAL = |
| 1659 const CompileTimeErrorCode('MISSING_CONST_IN_MAP_LITERAL', | 1657 const CompileTimeErrorCode('MISSING_CONST_IN_MAP_LITERAL', |
| 1660 "Map literals must be prefixed with 'const' when used as a constant ex
pression"); | 1658 "Map literals must be prefixed with 'const' when used as a constant ex
pression"); |
| 1661 | 1659 |
| 1662 /** | 1660 /** |
| 1663 * Enum proposal: It is a static warning if all of the following conditions | |
| 1664 * hold: | |
| 1665 * * The switch statement does not have a 'default' clause. | |
| 1666 * * The static type of <i>e</i> is an enumerated typed with elements | |
| 1667 * <i>id<sub>1</sub></i>, …, <i>id<sub>n</sub></i>. | |
| 1668 * * The sets {<i>e<sub>1</sub></i>, …, <i>e<sub>k</sub></i>} and | |
| 1669 * {<i>id<sub>1</sub></i>, …, <i>id<sub>n</sub></i>} are not the | |
| 1670 * same. | |
| 1671 * | |
| 1672 * Parameters: | |
| 1673 * 0: the name of the constant that is missing | |
| 1674 */ | |
| 1675 static const CompileTimeErrorCode MISSING_ENUM_CONSTANT_IN_SWITCH = | |
| 1676 const CompileTimeErrorCode( | |
| 1677 'MISSING_ENUM_CONSTANT_IN_SWITCH', | |
| 1678 "Missing case clause for '{0}'", | |
| 1679 "Add a case clause for the missing constant or add a default clause.")
; | |
| 1680 | |
| 1681 /** | |
| 1682 * 9 Mixins: It is a compile-time error if a declared or derived mixin | 1661 * 9 Mixins: It is a compile-time error if a declared or derived mixin |
| 1683 * explicitly declares a constructor. | 1662 * explicitly declares a constructor. |
| 1684 * | 1663 * |
| 1685 * Parameters: | 1664 * Parameters: |
| 1686 * 0: the name of the mixin that is invalid | 1665 * 0: the name of the mixin that is invalid |
| 1687 */ | 1666 */ |
| 1688 static const CompileTimeErrorCode MIXIN_DECLARES_CONSTRUCTOR = | 1667 static const CompileTimeErrorCode MIXIN_DECLARES_CONSTRUCTOR = |
| 1689 const CompileTimeErrorCode('MIXIN_DECLARES_CONSTRUCTOR', | 1668 const CompileTimeErrorCode('MIXIN_DECLARES_CONSTRUCTOR', |
| 1690 "The class '{0}' cannot be used as a mixin because it declares a const
ructor"); | 1669 "The class '{0}' cannot be used as a mixin because it declares a const
ructor"); |
| 1691 | 1670 |
| (...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2608 CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS, | 2587 CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS, |
| 2609 CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_LIST, | 2588 CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_LIST, |
| 2610 CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_MAP, | 2589 CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_MAP, |
| 2611 CompileTimeErrorCode.INVALID_URI, | 2590 CompileTimeErrorCode.INVALID_URI, |
| 2612 CompileTimeErrorCode.LABEL_IN_OUTER_SCOPE, | 2591 CompileTimeErrorCode.LABEL_IN_OUTER_SCOPE, |
| 2613 CompileTimeErrorCode.LABEL_UNDEFINED, | 2592 CompileTimeErrorCode.LABEL_UNDEFINED, |
| 2614 CompileTimeErrorCode.MEMBER_WITH_CLASS_NAME, | 2593 CompileTimeErrorCode.MEMBER_WITH_CLASS_NAME, |
| 2615 CompileTimeErrorCode.METHOD_AND_GETTER_WITH_SAME_NAME, | 2594 CompileTimeErrorCode.METHOD_AND_GETTER_WITH_SAME_NAME, |
| 2616 CompileTimeErrorCode.MISSING_CONST_IN_LIST_LITERAL, | 2595 CompileTimeErrorCode.MISSING_CONST_IN_LIST_LITERAL, |
| 2617 CompileTimeErrorCode.MISSING_CONST_IN_MAP_LITERAL, | 2596 CompileTimeErrorCode.MISSING_CONST_IN_MAP_LITERAL, |
| 2618 CompileTimeErrorCode.MISSING_ENUM_CONSTANT_IN_SWITCH, | |
| 2619 CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR, | 2597 CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR, |
| 2620 CompileTimeErrorCode.MIXIN_DEFERRED_CLASS, | 2598 CompileTimeErrorCode.MIXIN_DEFERRED_CLASS, |
| 2621 CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS, | 2599 CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS, |
| 2622 CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT, | 2600 CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT, |
| 2623 CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS, | 2601 CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS, |
| 2624 CompileTimeErrorCode.MIXIN_OF_ENUM, | 2602 CompileTimeErrorCode.MIXIN_OF_ENUM, |
| 2625 CompileTimeErrorCode.MIXIN_OF_NON_CLASS, | 2603 CompileTimeErrorCode.MIXIN_OF_NON_CLASS, |
| 2626 CompileTimeErrorCode.MIXIN_REFERENCES_SUPER, | 2604 CompileTimeErrorCode.MIXIN_REFERENCES_SUPER, |
| 2627 CompileTimeErrorCode.MIXIN_WITH_NON_CLASS_SUPERCLASS, | 2605 CompileTimeErrorCode.MIXIN_WITH_NON_CLASS_SUPERCLASS, |
| 2628 CompileTimeErrorCode.MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS, | 2606 CompileTimeErrorCode.MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS, |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2843 StaticWarningCode.UNDEFINED_CLASS, | 2821 StaticWarningCode.UNDEFINED_CLASS, |
| 2844 StaticWarningCode.UNDEFINED_CLASS_BOOLEAN, | 2822 StaticWarningCode.UNDEFINED_CLASS_BOOLEAN, |
| 2845 StaticWarningCode.UNDEFINED_GETTER, | 2823 StaticWarningCode.UNDEFINED_GETTER, |
| 2846 StaticWarningCode.UNDEFINED_IDENTIFIER, | 2824 StaticWarningCode.UNDEFINED_IDENTIFIER, |
| 2847 StaticWarningCode.UNDEFINED_NAMED_PARAMETER, | 2825 StaticWarningCode.UNDEFINED_NAMED_PARAMETER, |
| 2848 StaticWarningCode.UNDEFINED_SETTER, | 2826 StaticWarningCode.UNDEFINED_SETTER, |
| 2849 StaticWarningCode.UNDEFINED_STATIC_METHOD_OR_GETTER, | 2827 StaticWarningCode.UNDEFINED_STATIC_METHOD_OR_GETTER, |
| 2850 StaticWarningCode.UNDEFINED_SUPER_GETTER, | 2828 StaticWarningCode.UNDEFINED_SUPER_GETTER, |
| 2851 StaticWarningCode.UNDEFINED_SUPER_SETTER, | 2829 StaticWarningCode.UNDEFINED_SUPER_SETTER, |
| 2852 StaticWarningCode.VOID_RETURN_FOR_GETTER, | 2830 StaticWarningCode.VOID_RETURN_FOR_GETTER, |
| 2831 StaticWarningCode.MISSING_ENUM_CONSTANT_IN_SWITCH, |
| 2853 TodoCode.TODO, | 2832 TodoCode.TODO, |
| 2854 | 2833 |
| 2855 // | 2834 // |
| 2856 // parser.dart: | 2835 // parser.dart: |
| 2857 // | 2836 // |
| 2858 ParserErrorCode.ABSTRACT_CLASS_MEMBER, | 2837 ParserErrorCode.ABSTRACT_CLASS_MEMBER, |
| 2859 ParserErrorCode.ABSTRACT_ENUM, | 2838 ParserErrorCode.ABSTRACT_ENUM, |
| 2860 ParserErrorCode.ABSTRACT_STATIC_METHOD, | 2839 ParserErrorCode.ABSTRACT_STATIC_METHOD, |
| 2861 ParserErrorCode.ABSTRACT_TOP_LEVEL_FUNCTION, | 2840 ParserErrorCode.ABSTRACT_TOP_LEVEL_FUNCTION, |
| 2862 ParserErrorCode.ABSTRACT_TOP_LEVEL_VARIABLE, | 2841 ParserErrorCode.ABSTRACT_TOP_LEVEL_VARIABLE, |
| (...skipping 2778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5641 "The setter '{0}' is not defined in a superclass of '{1}'"); | 5620 "The setter '{0}' is not defined in a superclass of '{1}'"); |
| 5642 | 5621 |
| 5643 /** | 5622 /** |
| 5644 * 7.2 Getters: It is a static warning if the return type of a getter is void. | 5623 * 7.2 Getters: It is a static warning if the return type of a getter is void. |
| 5645 */ | 5624 */ |
| 5646 static const StaticWarningCode VOID_RETURN_FOR_GETTER = | 5625 static const StaticWarningCode VOID_RETURN_FOR_GETTER = |
| 5647 const StaticWarningCode('VOID_RETURN_FOR_GETTER', | 5626 const StaticWarningCode('VOID_RETURN_FOR_GETTER', |
| 5648 "The return type of the getter must not be 'void'"); | 5627 "The return type of the getter must not be 'void'"); |
| 5649 | 5628 |
| 5650 /** | 5629 /** |
| 5630 * 17.9 Switch: It is a static warning if all of the following conditions |
| 5631 * hold: |
| 5632 * * The switch statement does not have a 'default' clause. |
| 5633 * * The static type of <i>e</i> is an enumerated typed with elements |
| 5634 * <i>id<sub>1</sub></i>, …, <i>id<sub>n</sub></i>. |
| 5635 * * The sets {<i>e<sub>1</sub></i>, …, <i>e<sub>k</sub></i>} and |
| 5636 * {<i>id<sub>1</sub></i>, …, <i>id<sub>n</sub></i>} are not the |
| 5637 * same. |
| 5638 * |
| 5639 * Parameters: |
| 5640 * 0: the name of the constant that is missing |
| 5641 */ |
| 5642 static const StaticWarningCode MISSING_ENUM_CONSTANT_IN_SWITCH = |
| 5643 const StaticWarningCode('MISSING_ENUM_CONSTANT_IN_SWITCH', |
| 5644 "Missing case clause for '{0}'", |
| 5645 "Add a case clause for the missing constant or add a default clause.")
; |
| 5646 |
| 5647 /** |
| 5651 * Initialize a newly created error code to have the given [name]. The message | 5648 * Initialize a newly created error code to have the given [name]. The message |
| 5652 * associated with the error will be created from the given [message] | 5649 * associated with the error will be created from the given [message] |
| 5653 * template. The correction associated with the error will be created from the | 5650 * template. The correction associated with the error will be created from the |
| 5654 * given [correction] template. | 5651 * given [correction] template. |
| 5655 */ | 5652 */ |
| 5656 const StaticWarningCode(String name, String message, [String correction]) | 5653 const StaticWarningCode(String name, String message, [String correction]) |
| 5657 : super(name, message, correction); | 5654 : super(name, message, correction); |
| 5658 | 5655 |
| 5659 @override | 5656 @override |
| 5660 ErrorSeverity get errorSeverity => ErrorType.STATIC_WARNING.severity; | 5657 ErrorSeverity get errorSeverity => ErrorType.STATIC_WARNING.severity; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5693 * Initialize a newly created error code to have the given [name]. | 5690 * Initialize a newly created error code to have the given [name]. |
| 5694 */ | 5691 */ |
| 5695 const TodoCode(String name) : super(name, "{0}"); | 5692 const TodoCode(String name) : super(name, "{0}"); |
| 5696 | 5693 |
| 5697 @override | 5694 @override |
| 5698 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; | 5695 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; |
| 5699 | 5696 |
| 5700 @override | 5697 @override |
| 5701 ErrorType get type => ErrorType.TODO; | 5698 ErrorType get type => ErrorType.TODO; |
| 5702 } | 5699 } |
| OLD | NEW |