| 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; | 5 library engine.resolver; |
| 6 | 6 |
| 7 import "dart:math" as math; | 7 import "dart:math" as math; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import 'package:analyzer/src/generated/utilities_collection.dart'; | 10 import 'package:analyzer/src/generated/utilities_collection.dart'; |
| (...skipping 4184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4195 return false; | 4195 return false; |
| 4196 } | 4196 } |
| 4197 } | 4197 } |
| 4198 // For switch members with no statements, don't visit the children, | 4198 // For switch members with no statements, don't visit the children, |
| 4199 // otherwise, return false if no return is found in the children | 4199 // otherwise, return false if no return is found in the children |
| 4200 // statements. | 4200 // statements. |
| 4201 if (!switchMember.statements.isEmpty && !switchMember.accept(this)) { | 4201 if (!switchMember.statements.isEmpty && !switchMember.accept(this)) { |
| 4202 return false; | 4202 return false; |
| 4203 } | 4203 } |
| 4204 } | 4204 } |
| 4205 // All of the members exit, determine whether there are possible cases |
| 4206 // that are not caught by the members. |
| 4207 DartType type = node.expression == null ? null : node.expression.bestType; |
| 4208 if (type is InterfaceType) { |
| 4209 ClassElement element = type.element; |
| 4210 if (element != null && element.isEnum) { |
| 4211 // If some of the enum values are not covered, then a warning will |
| 4212 // have already been generated, so there's no point in generating a |
| 4213 // hint. |
| 4214 return true; |
| 4215 } |
| 4216 } |
| 4205 return hasDefault; | 4217 return hasDefault; |
| 4206 } finally { | 4218 } finally { |
| 4207 _enclosingBlockContainsBreak = outerBreakValue; | 4219 _enclosingBlockContainsBreak = outerBreakValue; |
| 4208 } | 4220 } |
| 4209 } | 4221 } |
| 4210 | 4222 |
| 4211 @override | 4223 @override |
| 4212 bool visitThisExpression(ThisExpression node) => false; | 4224 bool visitThisExpression(ThisExpression node) => false; |
| 4213 | 4225 |
| 4214 @override | 4226 @override |
| (...skipping 11460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15675 * library. | 15687 * library. |
| 15676 */ | 15688 */ |
| 15677 final HashSet<String> members = new HashSet<String>(); | 15689 final HashSet<String> members = new HashSet<String>(); |
| 15678 | 15690 |
| 15679 /** | 15691 /** |
| 15680 * Names of resolved or unresolved class members that are read in the | 15692 * Names of resolved or unresolved class members that are read in the |
| 15681 * library. | 15693 * library. |
| 15682 */ | 15694 */ |
| 15683 final HashSet<String> readMembers = new HashSet<String>(); | 15695 final HashSet<String> readMembers = new HashSet<String>(); |
| 15684 } | 15696 } |
| OLD | NEW |