| 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 universe; | 5 library universe; |
| 6 | 6 |
| 7 import '../closure.dart'; | 7 import '../closure.dart'; |
| 8 import '../elements/elements.dart'; | 8 import '../elements/elements.dart'; |
| 9 import '../dart2jslib.dart'; | 9 import '../dart2jslib.dart'; |
| 10 import '../dart_types.dart'; | 10 import '../dart_types.dart'; |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 | 512 |
| 513 // TODO(kasperl): Can't we just avoid creating typed selectors | 513 // TODO(kasperl): Can't we just avoid creating typed selectors |
| 514 // based of function types? | 514 // based of function types? |
| 515 Element self = mask.base.element; | 515 Element self = mask.base.element; |
| 516 if (self.isTypedef()) { | 516 if (self.isTypedef()) { |
| 517 // A typedef is a function type that doesn't have any | 517 // A typedef is a function type that doesn't have any |
| 518 // user-defined members. | 518 // user-defined members. |
| 519 return false; | 519 return false; |
| 520 } | 520 } |
| 521 | 521 |
| 522 if (mask.isNullable && compiler.backend.isNullImplementation(other)) { | 522 if (compiler.backend.isNullImplementation(other)) { |
| 523 return appliesUntyped(element, compiler); | 523 return mask.isNullable && appliesUntyped(element, compiler); |
| 524 } else if (mask.isExact) { | 524 } else if (mask.isExact) { |
| 525 return hasElementIn(self, element) && appliesUntyped(element, compiler); | 525 return hasElementIn(self, element) && appliesUntyped(element, compiler); |
| 526 } else if (mask.isSubclass) { | 526 } else if (mask.isSubclass) { |
| 527 return (hasElementIn(self, element) | 527 return (hasElementIn(self, element) |
| 528 || other.isSubclassOf(self) | 528 || other.isSubclassOf(self) |
| 529 || compiler.world.hasAnySubclassThatMixes(self, other)) | 529 || compiler.world.hasAnySubclassThatMixes(self, other)) |
| 530 && appliesUntyped(element, compiler); | 530 && appliesUntyped(element, compiler); |
| 531 } else { | 531 } else { |
| 532 assert(mask.isSubtype); | 532 assert(mask.isSubtype); |
| 533 if (other.implementsInterface(self) | 533 if (other.implementsInterface(self) |
| 534 || other.isSubclassOf(self) | 534 || other.isSubclassOf(self) |
| 535 || compiler.world.hasAnySubclassThatMixes(self, other) | 535 || compiler.world.hasAnySubclassThatMixes(self, other) |
| 536 || compiler.world.hasAnySubclassThatImplements(other, mask.base)) { | 536 || compiler.world.hasAnySubclassThatImplements(other, mask.base)) { |
| 537 return appliesUntyped(element, compiler); | 537 return appliesUntyped(element, compiler); |
| 538 } | 538 } |
| 539 | 539 |
| 540 // If [self] is a subclass of [other], it inherits the | 540 // If [self] is a subclass of [other], it inherits the |
| 541 // implementation of [element]. | 541 // implementation of [element]. |
| 542 ClassElement cls = self; | 542 ClassElement cls = self; |
| 543 if (cls.isSubclassOf(other)) { | 543 if (cls.isSubclassOf(other)) { |
| 544 // Resolve an invocation of [element.name] on [self]. If it | 544 // Resolve an invocation of [element.name] on [self]. If it |
| 545 // is found, this selector is a candidate. | 545 // is found, this selector is a candidate. |
| 546 return hasElementIn(cls, element) && appliesUntyped(element, compiler); | 546 return hasElementIn(cls, element) && appliesUntyped(element, compiler); |
| 547 } | 547 } |
| 548 } | 548 } |
| 549 return false; | 549 return false; |
| 550 } | 550 } |
| 551 } | 551 } |
| OLD | NEW |