| 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/ast/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
| (...skipping 3298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3309 String name = type.name; | 3309 String name = type.name; |
| 3310 if (name != null && name.length > 0) { | 3310 if (name != null && name.length > 0) { |
| 3311 StringBuffer buffer = new StringBuffer(); | 3311 StringBuffer buffer = new StringBuffer(); |
| 3312 buffer.write(name); | 3312 buffer.write(name); |
| 3313 (type as TypeImpl).appendTo(buffer); | 3313 (type as TypeImpl).appendTo(buffer); |
| 3314 return buffer.toString(); | 3314 return buffer.toString(); |
| 3315 } | 3315 } |
| 3316 } | 3316 } |
| 3317 return type.displayName; | 3317 return type.displayName; |
| 3318 } | 3318 } |
| 3319 |
| 3319 if (_hasEqualTypeNames(arguments)) { | 3320 if (_hasEqualTypeNames(arguments)) { |
| 3320 int count = arguments.length; | 3321 int count = arguments.length; |
| 3321 for (int i = 0; i < count; i++) { | 3322 for (int i = 0; i < count; i++) { |
| 3322 Object argument = arguments[i]; | 3323 Object argument = arguments[i]; |
| 3323 if (argument is DartType) { | 3324 if (argument is DartType) { |
| 3324 Element element = argument.element; | 3325 Element element = argument.element; |
| 3325 if (element == null) { | 3326 if (element == null) { |
| 3326 arguments[i] = displayName(argument); | 3327 arguments[i] = displayName(argument); |
| 3327 } else { | 3328 } else { |
| 3328 arguments[i] = | 3329 arguments[i] = |
| (...skipping 1993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5322 */ | 5323 */ |
| 5323 static const StaticWarningCode | 5324 static const StaticWarningCode |
| 5324 MISMATCHED_GETTER_AND_SETTER_TYPES_FROM_SUPERTYPE = | 5325 MISMATCHED_GETTER_AND_SETTER_TYPES_FROM_SUPERTYPE = |
| 5325 const StaticWarningCode( | 5326 const StaticWarningCode( |
| 5326 'MISMATCHED_GETTER_AND_SETTER_TYPES_FROM_SUPERTYPE', | 5327 'MISMATCHED_GETTER_AND_SETTER_TYPES_FROM_SUPERTYPE', |
| 5327 "The parameter type for setter '{0}' is '{1}' which is not assignable
to its getter (of type '{2}'), from superclass '{3}'", | 5328 "The parameter type for setter '{0}' is '{1}' which is not assignable
to its getter (of type '{2}'), from superclass '{3}'", |
| 5328 null, | 5329 null, |
| 5329 false); | 5330 false); |
| 5330 | 5331 |
| 5331 /** | 5332 /** |
| 5333 * 17.9 Switch: It is a static warning if all of the following conditions |
| 5334 * hold: |
| 5335 * * The switch statement does not have a 'default' clause. |
| 5336 * * The static type of <i>e</i> is an enumerated typed with elements |
| 5337 * <i>id<sub>1</sub></i>, …, <i>id<sub>n</sub></i>. |
| 5338 * * The sets {<i>e<sub>1</sub></i>, …, <i>e<sub>k</sub></i>} and |
| 5339 * {<i>id<sub>1</sub></i>, …, <i>id<sub>n</sub></i>} are not the |
| 5340 * same. |
| 5341 * |
| 5342 * Parameters: |
| 5343 * 0: the name of the constant that is missing |
| 5344 */ |
| 5345 static const StaticWarningCode MISSING_ENUM_CONSTANT_IN_SWITCH = |
| 5346 const StaticWarningCode( |
| 5347 'MISSING_ENUM_CONSTANT_IN_SWITCH', |
| 5348 "Missing case clause for '{0}'", |
| 5349 "Add a case clause for the missing constant or add a default clause.", |
| 5350 false); |
| 5351 |
| 5352 /** |
| 5332 * 13.12 Return: It is a static warning if a function contains both one or | 5353 * 13.12 Return: It is a static warning if a function contains both one or |
| 5333 * more return statements of the form <i>return;</i> and one or more return | 5354 * more return statements of the form <i>return;</i> and one or more return |
| 5334 * statements of the form <i>return e;</i>. | 5355 * statements of the form <i>return e;</i>. |
| 5335 */ | 5356 */ |
| 5336 static const StaticWarningCode MIXED_RETURN_TYPES = const StaticWarningCode( | 5357 static const StaticWarningCode MIXED_RETURN_TYPES = const StaticWarningCode( |
| 5337 'MIXED_RETURN_TYPES', | 5358 'MIXED_RETURN_TYPES', |
| 5338 "Methods and functions cannot use return both with and without values", | 5359 "Methods and functions cannot use return both with and without values", |
| 5339 null, | 5360 null, |
| 5340 false); | 5361 false); |
| 5341 | 5362 |
| (...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5845 shared_messages.UNDEFINED_SUPER_SETTER_STATIC_WARNING; | 5866 shared_messages.UNDEFINED_SUPER_SETTER_STATIC_WARNING; |
| 5846 | 5867 |
| 5847 /** | 5868 /** |
| 5848 * 7.2 Getters: It is a static warning if the return type of a getter is void. | 5869 * 7.2 Getters: It is a static warning if the return type of a getter is void. |
| 5849 */ | 5870 */ |
| 5850 static const StaticWarningCode VOID_RETURN_FOR_GETTER = | 5871 static const StaticWarningCode VOID_RETURN_FOR_GETTER = |
| 5851 const StaticWarningCode('VOID_RETURN_FOR_GETTER', | 5872 const StaticWarningCode('VOID_RETURN_FOR_GETTER', |
| 5852 "The return type of the getter must not be 'void'", null, false); | 5873 "The return type of the getter must not be 'void'", null, false); |
| 5853 | 5874 |
| 5854 /** | 5875 /** |
| 5855 * 17.9 Switch: It is a static warning if all of the following conditions | |
| 5856 * hold: | |
| 5857 * * The switch statement does not have a 'default' clause. | |
| 5858 * * The static type of <i>e</i> is an enumerated typed with elements | |
| 5859 * <i>id<sub>1</sub></i>, …, <i>id<sub>n</sub></i>. | |
| 5860 * * The sets {<i>e<sub>1</sub></i>, …, <i>e<sub>k</sub></i>} and | |
| 5861 * {<i>id<sub>1</sub></i>, …, <i>id<sub>n</sub></i>} are not the | |
| 5862 * same. | |
| 5863 * | |
| 5864 * Parameters: | |
| 5865 * 0: the name of the constant that is missing | |
| 5866 */ | |
| 5867 static const StaticWarningCode MISSING_ENUM_CONSTANT_IN_SWITCH = | |
| 5868 const StaticWarningCode( | |
| 5869 'MISSING_ENUM_CONSTANT_IN_SWITCH', | |
| 5870 "Missing case clause for '{0}'", | |
| 5871 "Add a case clause for the missing constant or add a default clause.", | |
| 5872 false); | |
| 5873 | |
| 5874 /** | |
| 5875 * A flag indicating whether this warning is an error when running with strong | 5876 * A flag indicating whether this warning is an error when running with strong |
| 5876 * mode enabled. | 5877 * mode enabled. |
| 5877 */ | 5878 */ |
| 5878 final bool isStrongModeError; | 5879 final bool isStrongModeError; |
| 5879 | 5880 |
| 5880 /** | 5881 /** |
| 5881 * Initialize a newly created error code to have the given [name]. The message | 5882 * Initialize a newly created error code to have the given [name]. The message |
| 5882 * associated with the error will be created from the given [message] | 5883 * associated with the error will be created from the given [message] |
| 5883 * template. The correction associated with the error will be created from the | 5884 * template. The correction associated with the error will be created from the |
| 5884 * given [correction] template. | 5885 * given [correction] template. |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6113 * Initialize a newly created error code to have the given [name]. | 6114 * Initialize a newly created error code to have the given [name]. |
| 6114 */ | 6115 */ |
| 6115 const TodoCode(String name) : super(name, "{0}"); | 6116 const TodoCode(String name) : super(name, "{0}"); |
| 6116 | 6117 |
| 6117 @override | 6118 @override |
| 6118 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; | 6119 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; |
| 6119 | 6120 |
| 6120 @override | 6121 @override |
| 6121 ErrorType get type => ErrorType.TODO; | 6122 ErrorType get type => ErrorType.TODO; |
| 6122 } | 6123 } |
| OLD | NEW |