| 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 elements; | 5 library elements; |
| 6 | 6 |
| 7 import 'dart:uri'; | 7 import 'dart:uri'; |
| 8 | 8 |
| 9 import 'modelx.dart'; | 9 import 'modelx.dart'; |
| 10 import '../tree/tree.dart'; | 10 import '../tree/tree.dart'; |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 } | 541 } |
| 542 return false; | 542 return false; |
| 543 } | 543 } |
| 544 | 544 |
| 545 static bool switchStatementHasDefault(SwitchStatement node) { | 545 static bool switchStatementHasDefault(SwitchStatement node) { |
| 546 for (SwitchCase switchCase in node.cases) { | 546 for (SwitchCase switchCase in node.cases) { |
| 547 if (switchCase.isDefaultCase) return true; | 547 if (switchCase.isDefaultCase) return true; |
| 548 } | 548 } |
| 549 return false; | 549 return false; |
| 550 } | 550 } |
| 551 |
| 552 static bool isUnusedLabel(LabeledStatement node, TreeElements elements) { |
| 553 Node body = node.statement; |
| 554 TargetElement element = elements[body]; |
| 555 // Labeled statements with no element on the body have no breaks. |
| 556 // A different target statement only happens if the body is itself |
| 557 // a break or continue for a different target. In that case, this |
| 558 // label is also always unused. |
| 559 return element == null || element.statement != body; |
| 560 } |
| 551 } | 561 } |
| 552 | 562 |
| 553 abstract class ErroneousElement extends Element implements FunctionElement { | 563 abstract class ErroneousElement extends Element implements FunctionElement { |
| 554 MessageKind get messageKind; | 564 MessageKind get messageKind; |
| 555 Map get messageArguments; | 565 Map get messageArguments; |
| 556 } | 566 } |
| 557 | 567 |
| 558 abstract class AmbiguousElement extends Element { | 568 abstract class AmbiguousElement extends Element { |
| 559 MessageKind get messageKind; | 569 MessageKind get messageKind; |
| 560 Map get messageArguments; | 570 Map get messageArguments; |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 int get resolutionState; | 907 int get resolutionState; |
| 898 Token get beginToken; | 908 Token get beginToken; |
| 899 Token get endToken; | 909 Token get endToken; |
| 900 | 910 |
| 901 // TODO(kasperl): Try to get rid of these. | 911 // TODO(kasperl): Try to get rid of these. |
| 902 void set annotatedElement(Element value); | 912 void set annotatedElement(Element value); |
| 903 void set resolutionState(int value); | 913 void set resolutionState(int value); |
| 904 | 914 |
| 905 MetadataAnnotation ensureResolved(Compiler compiler); | 915 MetadataAnnotation ensureResolved(Compiler compiler); |
| 906 } | 916 } |
| OLD | NEW |