| 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.world; | 5 library dart2js.world; |
| 6 | 6 |
| 7 import 'closure.dart' show ClosureClassElement, SynthesizedCallMethodElementX; | 7 import 'closure.dart' show ClosureClassElement, SynthesizedCallMethodElementX; |
| 8 import 'common/backend_api.dart' show BackendClasses; | 8 import 'common/backend_api.dart' show BackendClasses; |
| 9 import 'common.dart'; | 9 import 'common.dart'; |
| 10 import 'constants/constant_system.dart'; | 10 import 'constants/constant_system.dart'; |
| (...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 923 @override | 923 @override |
| 924 bool hasElementIn(ClassElement cls, Selector selector, Element element) { | 924 bool hasElementIn(ClassElement cls, Selector selector, Element element) { |
| 925 // Use [:implementation:] of [element] | 925 // Use [:implementation:] of [element] |
| 926 // because our function set only stores declarations. | 926 // because our function set only stores declarations. |
| 927 Element result = findMatchIn(cls, selector); | 927 Element result = findMatchIn(cls, selector); |
| 928 return result == null | 928 return result == null |
| 929 ? false | 929 ? false |
| 930 : result.implementation == element.implementation; | 930 : result.implementation == element.implementation; |
| 931 } | 931 } |
| 932 | 932 |
| 933 Element findMatchIn(ClassElement cls, Selector selector, | 933 MemberElement findMatchIn(ClassElement cls, Selector selector, |
| 934 {ClassElement stopAtSuperclass}) { | 934 {ClassElement stopAtSuperclass}) { |
| 935 // Use the [:implementation] of [cls] in case the found [element] | 935 // Use the [:implementation] of [cls] in case the found [element] |
| 936 // is in the patch class. | 936 // is in the patch class. |
| 937 var result = cls.implementation | 937 return cls.implementation |
| 938 .lookupByName(selector.memberName, stopAt: stopAtSuperclass); | 938 .lookupByName(selector.memberName, stopAt: stopAtSuperclass); |
| 939 return result; | |
| 940 } | 939 } |
| 941 | 940 |
| 942 /// Returns whether a [selector] call on an instance of [cls] | 941 /// Returns whether a [selector] call on an instance of [cls] |
| 943 /// will hit a method at runtime, and not go through [noSuchMethod]. | 942 /// will hit a method at runtime, and not go through [noSuchMethod]. |
| 944 bool hasConcreteMatch(ClassElement cls, Selector selector, | 943 bool hasConcreteMatch(ClassElement cls, Selector selector, |
| 945 {ClassElement stopAtSuperclass}) { | 944 {ClassElement stopAtSuperclass}) { |
| 946 assert(invariant(cls, isInstantiated(cls), | 945 assert(invariant(cls, isInstantiated(cls), |
| 947 message: '$cls has not been instantiated.')); | 946 message: '$cls has not been instantiated.')); |
| 948 Element element = findMatchIn(cls, selector); | 947 MemberElement element = findMatchIn(cls, selector); |
| 949 if (element == null) return false; | 948 if (element == null) return false; |
| 950 | 949 |
| 951 if (element.isAbstract) { | 950 if (element.isAbstract) { |
| 952 ClassElement enclosingClass = element.enclosingClass; | 951 ClassElement enclosingClass = element.enclosingClass; |
| 953 return hasConcreteMatch(enclosingClass.superclass, selector); | 952 return hasConcreteMatch(enclosingClass.superclass, selector); |
| 954 } | 953 } |
| 955 return selector.appliesUntyped(element); | 954 return selector.appliesUntyped(element); |
| 956 } | 955 } |
| 957 | 956 |
| 958 @override | 957 @override |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1192 return getMightBePassedToApply(element.expression); | 1191 return getMightBePassedToApply(element.expression); |
| 1193 } | 1192 } |
| 1194 return functionsThatMightBePassedToApply.contains(element); | 1193 return functionsThatMightBePassedToApply.contains(element); |
| 1195 } | 1194 } |
| 1196 | 1195 |
| 1197 @override | 1196 @override |
| 1198 bool getCurrentlyKnownMightBePassedToApply(Element element) { | 1197 bool getCurrentlyKnownMightBePassedToApply(Element element) { |
| 1199 return getMightBePassedToApply(element); | 1198 return getMightBePassedToApply(element); |
| 1200 } | 1199 } |
| 1201 } | 1200 } |
| OLD | NEW |