| Index: pkg/analyzer/lib/src/generated/resolver.dart
|
| diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
|
| index ca02438d7ee4fb47d33baf18f7a934a0e4910bd9..b7f28c5a087268dff533243f3a5950680dfcf9c8 100644
|
| --- a/pkg/analyzer/lib/src/generated/resolver.dart
|
| +++ b/pkg/analyzer/lib/src/generated/resolver.dart
|
| @@ -3755,24 +3755,29 @@ class ExitDetector extends GeneralizingAstVisitor<bool> {
|
| _enclosingBlockContainsBreak = false;
|
| try {
|
| bool hasDefault = false;
|
| + bool hasNonExitingCase = false;
|
| List<SwitchMember> members = node.members;
|
| for (int i = 0; i < members.length; i++) {
|
| SwitchMember switchMember = members[i];
|
| if (switchMember is SwitchDefault) {
|
| hasDefault = true;
|
| - // If this is the last member and there are no statements, return
|
| - // false
|
| + // If this is the last member and there are no statements, then it
|
| + // does not exit.
|
| if (switchMember.statements.isEmpty && i + 1 == members.length) {
|
| - return false;
|
| + hasNonExitingCase = true;
|
| + continue;
|
| }
|
| }
|
| - // For switch members with no statements, don't visit the children,
|
| - // otherwise, return false if no return is found in the children
|
| - // statements.
|
| + // For switch members with no statements, don't visit the children.
|
| + // Otherwise, if there children statements don't exit, mark this as a
|
| + // non-exiting case.
|
| if (!switchMember.statements.isEmpty && !switchMember.accept(this)) {
|
| - return false;
|
| + hasNonExitingCase = true;
|
| }
|
| }
|
| + if (hasNonExitingCase) {
|
| + return false;
|
| + }
|
| // As all cases exit, return whether that list includes `default`.
|
| return hasDefault;
|
| } finally {
|
|
|