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.dart'; | 9 import 'common.dart'; |
10 import 'common/backend_api.dart' show | 10 import 'common/backend_api.dart' show |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
302 } | 302 } |
303 | 303 |
304 /// Returns `true` if any directly instantiated class other than [cls] | 304 /// Returns `true` if any directly instantiated class other than [cls] |
305 /// implements [cls]. | 305 /// implements [cls]. |
306 bool hasAnyStrictSubtype(ClassElement cls) { | 306 bool hasAnyStrictSubtype(ClassElement cls) { |
307 return !strictSubtypesOf(cls).isEmpty; | 307 return !strictSubtypesOf(cls).isEmpty; |
308 } | 308 } |
309 | 309 |
310 /// Returns `true` if all directly instantiated classes that implement [cls] | 310 /// Returns `true` if all directly instantiated classes that implement [cls] |
311 /// extend it. | 311 /// extend it. |
312 bool hasOnlySubclasses(ClassElement cls) { | 312 bool hasOnlySubclasses(ClassElement cls) { |
Johnni Winther
2015/12/16 09:07:08
Add a TODO for me to move this to [ClassSet].
Siggi Cherem (dart-lang)
2015/12/17 01:02:57
Done.
| |
313 if (cls == objectClass) return true; | |
313 Iterable<ClassElement> subtypes = strictSubtypesOf(cls); | 314 Iterable<ClassElement> subtypes = strictSubtypesOf(cls); |
314 if (subtypes == null) return true; | 315 if (subtypes == null) return true; |
315 Iterable<ClassElement> subclasses = strictSubclassesOf(cls); | 316 Iterable<ClassElement> subclasses = strictSubclassesOf(cls); |
316 return subclasses != null && (subclasses.length == subtypes.length); | 317 return subclasses != null && (subclasses.length == subtypes.length); |
317 } | 318 } |
318 | 319 |
319 @override | 320 @override |
320 ClassElement getLubOfInstantiatedSubclasses(ClassElement cls) { | 321 ClassElement getLubOfInstantiatedSubclasses(ClassElement cls) { |
321 ClassHierarchyNode hierarchy = _classHierarchyNodes[cls.declaration]; | 322 ClassHierarchyNode hierarchy = _classHierarchyNodes[cls.declaration]; |
322 return hierarchy != null | 323 return hierarchy != null |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
753 // function expressions's element. | 754 // function expressions's element. |
754 // TODO(herhut): Generate classes for function expressions earlier. | 755 // TODO(herhut): Generate classes for function expressions earlier. |
755 if (element is SynthesizedCallMethodElementX) { | 756 if (element is SynthesizedCallMethodElementX) { |
756 return getMightBePassedToApply(element.expression); | 757 return getMightBePassedToApply(element.expression); |
757 } | 758 } |
758 return functionsThatMightBePassedToApply.contains(element); | 759 return functionsThatMightBePassedToApply.contains(element); |
759 } | 760 } |
760 | 761 |
761 bool get hasClosedWorldAssumption => !compiler.hasIncrementalSupport; | 762 bool get hasClosedWorldAssumption => !compiler.hasIncrementalSupport; |
762 } | 763 } |
OLD | NEW |