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 | 7 import 'closure.dart' show |
8 SynthesizedCallMethodElementX; | 8 SynthesizedCallMethodElementX; |
9 import 'common/backend_api.dart' show | 9 import 'common/backend_api.dart' show |
10 Backend; | 10 Backend; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 bool isSubtypeOf(ClassElement x, ClassElement y); | 80 bool isSubtypeOf(ClassElement x, ClassElement y); |
81 | 81 |
82 /// Returns an iterable over the live classes that extend [cls] including | 82 /// Returns an iterable over the live classes that extend [cls] including |
83 /// [cls] itself. | 83 /// [cls] itself. |
84 Iterable<ClassElement> subclassesOf(ClassElement cls); | 84 Iterable<ClassElement> subclassesOf(ClassElement cls); |
85 | 85 |
86 /// Returns an iterable over the live classes that extend [cls] _not_ | 86 /// Returns an iterable over the live classes that extend [cls] _not_ |
87 /// including [cls] itself. | 87 /// including [cls] itself. |
88 Iterable<ClassElement> strictSubclassesOf(ClassElement cls); | 88 Iterable<ClassElement> strictSubclassesOf(ClassElement cls); |
89 | 89 |
| 90 /// Returns an iterable over the directly instantiated that implement [cls] |
| 91 /// possibly including [cls] itself, if it is live. |
| 92 Iterable<ClassElement> subtypesOf(ClassElement cls); |
| 93 |
90 /// Returns an iterable over the live classes that implement [cls] _not_ | 94 /// Returns an iterable over the live classes that implement [cls] _not_ |
91 /// including [cls] if it is live. | 95 /// including [cls] if it is live. |
92 Iterable<ClassElement> strictSubtypesOf(ClassElement cls); | 96 Iterable<ClassElement> strictSubtypesOf(ClassElement cls); |
93 | 97 |
94 /// Returns `true` if [a] and [b] have any known common subtypes. | 98 /// Returns `true` if [a] and [b] have any known common subtypes. |
95 bool haveAnyCommonSubtypes(ClassElement a, ClassElement b); | 99 bool haveAnyCommonSubtypes(ClassElement a, ClassElement b); |
96 | 100 |
97 /// Returns `true` if any live class other than [cls] extends [cls]. | 101 /// Returns `true` if any live class other than [cls] extends [cls]. |
98 bool hasAnyStrictSubclass(ClassElement cls); | 102 bool hasAnyStrictSubclass(ClassElement cls); |
99 | 103 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 Iterable<ClassElement> strictSubclassesOf(ClassElement cls) { | 215 Iterable<ClassElement> strictSubclassesOf(ClassElement cls) { |
212 ClassHierarchyNode subclasses = _classHierarchyNodes[cls.declaration]; | 216 ClassHierarchyNode subclasses = _classHierarchyNodes[cls.declaration]; |
213 if (subclasses == null) return const <ClassElement>[]; | 217 if (subclasses == null) return const <ClassElement>[]; |
214 return subclasses.subclasses( | 218 return subclasses.subclasses( |
215 strict: true, | 219 strict: true, |
216 includeIndirectlyInstantiated: false, | 220 includeIndirectlyInstantiated: false, |
217 includeUninstantiated: false); | 221 includeUninstantiated: false); |
218 } | 222 } |
219 | 223 |
220 /// Returns an iterable over the directly instantiated that implement [cls] | 224 /// Returns an iterable over the directly instantiated that implement [cls] |
| 225 /// possibly including [cls] itself, if it is live. |
| 226 Iterable<ClassElement> subtypesOf(ClassElement cls) { |
| 227 ClassSet classSet = _classSets[cls.declaration]; |
| 228 if (classSet == null) { |
| 229 return const <ClassElement>[]; |
| 230 } else { |
| 231 return classSet.subtypes( |
| 232 includeIndirectlyInstantiated: false, |
| 233 includeUninstantiated: false); |
| 234 } |
| 235 } |
| 236 |
| 237 /// Returns an iterable over the directly instantiated that implement [cls] |
221 /// _not_ including [cls]. | 238 /// _not_ including [cls]. |
222 Iterable<ClassElement> strictSubtypesOf(ClassElement cls) { | 239 Iterable<ClassElement> strictSubtypesOf(ClassElement cls) { |
223 ClassSet classSet = _classSets[cls.declaration]; | 240 ClassSet classSet = _classSets[cls.declaration]; |
224 if (classSet == null) { | 241 if (classSet == null) { |
225 return const <ClassElement>[]; | 242 return const <ClassElement>[]; |
226 } else { | 243 } else { |
227 return classSet.subtypes( | 244 return classSet.subtypes( |
228 strict: true, | 245 strict: true, |
229 includeIndirectlyInstantiated: false, | 246 includeIndirectlyInstantiated: false, |
230 includeUninstantiated: false); | 247 includeUninstantiated: false); |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
675 // function expressions's element. | 692 // function expressions's element. |
676 // TODO(herhut): Generate classes for function expressions earlier. | 693 // TODO(herhut): Generate classes for function expressions earlier. |
677 if (element is SynthesizedCallMethodElementX) { | 694 if (element is SynthesizedCallMethodElementX) { |
678 return getMightBePassedToApply(element.expression); | 695 return getMightBePassedToApply(element.expression); |
679 } | 696 } |
680 return functionsThatMightBePassedToApply.contains(element); | 697 return functionsThatMightBePassedToApply.contains(element); |
681 } | 698 } |
682 | 699 |
683 bool get hasClosedWorldAssumption => !compiler.hasIncrementalSupport; | 700 bool get hasClosedWorldAssumption => !compiler.hasIncrementalSupport; |
684 } | 701 } |
OLD | NEW |