| 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.resolver.error_verifier; | 5 library engine.resolver.error_verifier; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import "dart:math" as math; | 8 import "dart:math" as math; |
| 9 | 9 |
| 10 import 'package:analyzer/src/generated/static_type_analyzer.dart'; | 10 import 'package:analyzer/src/generated/static_type_analyzer.dart'; |
| (...skipping 4095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4106 String constantName = _getConstantName((member as SwitchCase).expression); | 4106 String constantName = _getConstantName((member as SwitchCase).expression); |
| 4107 if (constantName != null) { | 4107 if (constantName != null) { |
| 4108 constantNames.remove(constantName); | 4108 constantNames.remove(constantName); |
| 4109 } | 4109 } |
| 4110 } | 4110 } |
| 4111 int nameCount = constantNames.length; | 4111 int nameCount = constantNames.length; |
| 4112 if (nameCount == 0) { | 4112 if (nameCount == 0) { |
| 4113 return false; | 4113 return false; |
| 4114 } | 4114 } |
| 4115 for (int i = 0; i < nameCount; i++) { | 4115 for (int i = 0; i < nameCount; i++) { |
| 4116 _errorReporter.reportErrorForNode( | 4116 int offset = statement.offset; |
| 4117 CompileTimeErrorCode.MISSING_ENUM_CONSTANT_IN_SWITCH, statement, | 4117 int end = statement.rightParenthesis.end; |
| 4118 _errorReporter.reportErrorForOffset( |
| 4119 CompileTimeErrorCode.MISSING_ENUM_CONSTANT_IN_SWITCH, offset, end - of
fset, |
| 4118 [constantNames[i]]); | 4120 [constantNames[i]]); |
| 4119 } | 4121 } |
| 4120 return true; | 4122 return true; |
| 4121 } | 4123 } |
| 4122 | 4124 |
| 4123 /** | 4125 /** |
| 4124 * Verify that the given function [body] does not contain return statements | 4126 * Verify that the given function [body] does not contain return statements |
| 4125 * that both have and do not have return values. | 4127 * that both have and do not have return values. |
| 4126 * | 4128 * |
| 4127 * See [StaticWarningCode.MIXED_RETURN_TYPES]. | 4129 * See [StaticWarningCode.MIXED_RETURN_TYPES]. |
| (...skipping 1857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5985 toCheck.add(type.element); | 5987 toCheck.add(type.element); |
| 5986 // type arguments | 5988 // type arguments |
| 5987 if (type is InterfaceType) { | 5989 if (type is InterfaceType) { |
| 5988 InterfaceType interfaceType = type; | 5990 InterfaceType interfaceType = type; |
| 5989 for (DartType typeArgument in interfaceType.typeArguments) { | 5991 for (DartType typeArgument in interfaceType.typeArguments) { |
| 5990 _addTypeToCheck(typeArgument); | 5992 _addTypeToCheck(typeArgument); |
| 5991 } | 5993 } |
| 5992 } | 5994 } |
| 5993 } | 5995 } |
| 5994 } | 5996 } |
| OLD | NEW |