| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 dart2js.resolution.members; | 5 library dart2js.resolution.members; |
| 6 | 6 |
| 7 import '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../common/names.dart' show Selectors; | 8 import '../common/names.dart' show Selectors; |
| 9 import '../common/resolution.dart' show Resolution; | 9 import '../common/resolution.dart' show Resolution; |
| 10 import '../compile_time_constants.dart'; | 10 import '../compile_time_constants.dart'; |
| (...skipping 4584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4595 LabelDefinition labelElement = targetElement.addLabel(label, labelName); | 4595 LabelDefinition labelElement = targetElement.addLabel(label, labelName); |
| 4596 registry.defineLabel(label, labelElement); | 4596 registry.defineLabel(label, labelElement); |
| 4597 continueLabels[labelName] = labelElement; | 4597 continueLabels[labelName] = labelElement; |
| 4598 } | 4598 } |
| 4599 cases = cases.tail; | 4599 cases = cases.tail; |
| 4600 // Test that only the last case, if any, is a default case. | 4600 // Test that only the last case, if any, is a default case. |
| 4601 if (switchCase.defaultKeyword != null && !cases.isEmpty) { | 4601 if (switchCase.defaultKeyword != null && !cases.isEmpty) { |
| 4602 reporter.reportErrorMessage( | 4602 reporter.reportErrorMessage( |
| 4603 switchCase, MessageKind.INVALID_CASE_DEFAULT); | 4603 switchCase, MessageKind.INVALID_CASE_DEFAULT); |
| 4604 } | 4604 } |
| 4605 if (cases.isNotEmpty) { | 4605 if (cases.isNotEmpty && switchCase.statements.isNotEmpty) { |
| 4606 Node last = switchCase.statements.last; | 4606 Node last = switchCase.statements.last; |
| 4607 if (last.asBreakStatement() == null && | 4607 if (last.asBreakStatement() == null && |
| 4608 last.asContinueStatement() == null && | 4608 last.asContinueStatement() == null && |
| 4609 last.asThrow() == null && | 4609 last.asThrow() == null && |
| 4610 last.asReturn() == null) { | 4610 last.asReturn() == null) { |
| 4611 registry.registerFeature(Feature.FALL_THROUGH_ERROR); | 4611 registry.registerFeature(Feature.FALL_THROUGH_ERROR); |
| 4612 } | 4612 } |
| 4613 } | 4613 } |
| 4614 } | 4614 } |
| 4615 | 4615 |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4740 } | 4740 } |
| 4741 return const NoneResult(); | 4741 return const NoneResult(); |
| 4742 } | 4742 } |
| 4743 } | 4743 } |
| 4744 | 4744 |
| 4745 /// Looks up [name] in [scope] and unwraps the result. | 4745 /// Looks up [name] in [scope] and unwraps the result. |
| 4746 Element lookupInScope( | 4746 Element lookupInScope( |
| 4747 DiagnosticReporter reporter, Node node, Scope scope, String name) { | 4747 DiagnosticReporter reporter, Node node, Scope scope, String name) { |
| 4748 return Elements.unwrap(scope.lookup(name), reporter, node); | 4748 return Elements.unwrap(scope.lookup(name), reporter, node); |
| 4749 } | 4749 } |
| OLD | NEW |