OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 part of types; | 5 part of types; |
6 | 6 |
7 /** | 7 /** |
8 * A flat type mask is a type mask that has been flattened to contain a | 8 * A flat type mask is a type mask that has been flattened to contain a |
9 * base type. | 9 * base type. |
10 */ | 10 */ |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 || classWorld.hasAnySubclassThatMixes(mixinApplication, other)); | 539 || classWorld.hasAnySubclassThatMixes(mixinApplication, other)); |
540 } | 540 } |
541 } | 541 } |
542 | 542 |
543 /** | 543 /** |
544 * Returns whether a [selector] call on an instance of [cls] | 544 * Returns whether a [selector] call on an instance of [cls] |
545 * will hit a method at runtime, and not go through [noSuchMethod]. | 545 * will hit a method at runtime, and not go through [noSuchMethod]. |
546 */ | 546 */ |
547 static bool hasConcreteMatch(ClassElement cls, | 547 static bool hasConcreteMatch(ClassElement cls, |
548 Selector selector, | 548 Selector selector, |
549 World world) { | 549 ClassWorld world) { |
550 assert(invariant(cls, | 550 assert(invariant(cls, world.isInstantiated(cls), |
551 world.compiler.resolverWorld.isInstantiated(cls), | |
552 message: '$cls has not been instantiated.')); | 551 message: '$cls has not been instantiated.')); |
553 Element element = findMatchIn(cls, selector); | 552 Element element = findMatchIn(cls, selector); |
554 if (element == null) return false; | 553 if (element == null) return false; |
555 | 554 |
556 if (element.isAbstract) { | 555 if (element.isAbstract) { |
557 ClassElement enclosingClass = element.enclosingClass; | 556 ClassElement enclosingClass = element.enclosingClass; |
558 return hasConcreteMatch(enclosingClass.superclass, selector, world); | 557 return hasConcreteMatch(enclosingClass.superclass, selector, world); |
559 } | 558 } |
560 return selector.appliesUntyped(element, world); | 559 return selector.appliesUntyped(element, world); |
561 } | 560 } |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 if (x.isExact) { | 703 if (x.isExact) { |
705 return null; | 704 return null; |
706 } else if (x.isSubclass) { | 705 } else if (x.isSubclass) { |
707 return classWorld.strictSubclassesOf(element); | 706 return classWorld.strictSubclassesOf(element); |
708 } else { | 707 } else { |
709 assert(x.isSubtype); | 708 assert(x.isSubtype); |
710 return classWorld.strictSubtypesOf(element); | 709 return classWorld.strictSubtypesOf(element); |
711 } | 710 } |
712 } | 711 } |
713 } | 712 } |
OLD | NEW |