| 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 | 7 |
| 8 import '../tree/tree.dart'; | 8 import '../tree/tree.dart'; |
| 9 import '../util/util.dart'; | 9 import '../util/util.dart'; |
| 10 import '../resolution/resolution.dart'; | 10 import '../resolution/resolution.dart'; |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 LabelElement labelElement = elements[label]; | 577 LabelElement labelElement = elements[label]; |
| 578 if (labelElement != null && labelElement.isContinueTarget) { | 578 if (labelElement != null && labelElement.isContinueTarget) { |
| 579 return true; | 579 return true; |
| 580 } | 580 } |
| 581 } | 581 } |
| 582 } | 582 } |
| 583 } | 583 } |
| 584 return false; | 584 return false; |
| 585 } | 585 } |
| 586 | 586 |
| 587 static bool switchStatementHasDefault(SwitchStatement node) { | |
| 588 for (SwitchCase switchCase in node.cases) { | |
| 589 if (switchCase.isDefaultCase) return true; | |
| 590 } | |
| 591 return false; | |
| 592 } | |
| 593 | |
| 594 static bool isUnusedLabel(LabeledStatement node, TreeElements elements) { | 587 static bool isUnusedLabel(LabeledStatement node, TreeElements elements) { |
| 595 Node body = node.statement; | 588 Node body = node.statement; |
| 596 TargetElement element = elements[body]; | 589 TargetElement element = elements[body]; |
| 597 // Labeled statements with no element on the body have no breaks. | 590 // Labeled statements with no element on the body have no breaks. |
| 598 // A different target statement only happens if the body is itself | 591 // A different target statement only happens if the body is itself |
| 599 // a break or continue for a different target. In that case, this | 592 // a break or continue for a different target. In that case, this |
| 600 // label is also always unused. | 593 // label is also always unused. |
| 601 return element == null || element.statement != body; | 594 return element == null || element.statement != body; |
| 602 } | 595 } |
| 603 } | 596 } |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 908 Element lookupSelector(Selector selector, Compiler compiler); | 901 Element lookupSelector(Selector selector, Compiler compiler); |
| 909 Element lookupSuperSelector(Selector selector, Compiler compiler); | 902 Element lookupSuperSelector(Selector selector, Compiler compiler); |
| 910 | 903 |
| 911 Element lookupLocalMember(String memberName); | 904 Element lookupLocalMember(String memberName); |
| 912 Element lookupBackendMember(String memberName); | 905 Element lookupBackendMember(String memberName); |
| 913 Element lookupSuperMember(String memberName); | 906 Element lookupSuperMember(String memberName); |
| 914 | 907 |
| 915 Element lookupSuperMemberInLibrary(String memberName, | 908 Element lookupSuperMemberInLibrary(String memberName, |
| 916 LibraryElement library); | 909 LibraryElement library); |
| 917 | 910 |
| 918 Element lookupSuperInterfaceMember(String memberName, | |
| 919 LibraryElement fromLibrary); | |
| 920 | |
| 921 Element validateConstructorLookupResults(Selector selector, | 911 Element validateConstructorLookupResults(Selector selector, |
| 922 Element result, | 912 Element result, |
| 923 Element noMatch(Element)); | 913 Element noMatch(Element)); |
| 924 | 914 |
| 925 Element lookupConstructor(Selector selector, [Element noMatch(Element)]); | 915 Element lookupConstructor(Selector selector, [Element noMatch(Element)]); |
| 926 Element lookupFactoryConstructor(Selector selector, | |
| 927 [Element noMatch(Element)]); | |
| 928 | 916 |
| 929 void forEachMember(void f(ClassElement enclosingClass, Element member), | 917 void forEachMember(void f(ClassElement enclosingClass, Element member), |
| 930 {bool includeBackendMembers: false, | 918 {bool includeBackendMembers: false, |
| 931 bool includeSuperAndInjectedMembers: false}); | 919 bool includeSuperAndInjectedMembers: false}); |
| 932 | 920 |
| 933 void forEachInstanceField(void f(ClassElement enclosingClass, Element field), | 921 void forEachInstanceField(void f(ClassElement enclosingClass, Element field), |
| 934 {bool includeSuperAndInjectedMembers: false}); | 922 {bool includeSuperAndInjectedMembers: false}); |
| 935 | 923 |
| 936 /// Similar to [forEachInstanceField] but visits static fields. | 924 /// Similar to [forEachInstanceField] but visits static fields. |
| 937 void forEachStaticField(void f(ClassElement enclosingClass, Element field)); | 925 void forEachStaticField(void f(ClassElement enclosingClass, Element field)); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 995 Token get endToken; | 983 Token get endToken; |
| 996 | 984 |
| 997 // TODO(kasperl): Try to get rid of these. | 985 // TODO(kasperl): Try to get rid of these. |
| 998 void set annotatedElement(Element value); | 986 void set annotatedElement(Element value); |
| 999 void set resolutionState(int value); | 987 void set resolutionState(int value); |
| 1000 | 988 |
| 1001 MetadataAnnotation ensureResolved(Compiler compiler); | 989 MetadataAnnotation ensureResolved(Compiler compiler); |
| 1002 } | 990 } |
| 1003 | 991 |
| 1004 abstract class VoidElement extends Element {} | 992 abstract class VoidElement extends Element {} |
| OLD | NEW |