| 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 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 | 500 |
| 501 // TODO(kasperl): Can't we just avoid creating typed selectors | 501 // TODO(kasperl): Can't we just avoid creating typed selectors |
| 502 // based of function types? | 502 // based of function types? |
| 503 Element self = mask.base.element; | 503 Element self = mask.base.element; |
| 504 if (self.isTypedef()) { | 504 if (self.isTypedef()) { |
| 505 // A typedef is a function type that doesn't have any | 505 // A typedef is a function type that doesn't have any |
| 506 // user-defined members. | 506 // user-defined members. |
| 507 return false; | 507 return false; |
| 508 } | 508 } |
| 509 | 509 |
| 510 if (mask.isExact) { | 510 if (mask.isNullable && compiler.backend.isNullImplementation(other)) { |
| 511 return appliesUntyped(element, compiler); |
| 512 } else if (mask.isExact) { |
| 511 return hasElementIn(self, element) && appliesUntyped(element, compiler); | 513 return hasElementIn(self, element) && appliesUntyped(element, compiler); |
| 512 } else if (mask.isSubclass) { | 514 } else if (mask.isSubclass) { |
| 513 return (hasElementIn(self, element) | 515 return (hasElementIn(self, element) |
| 514 || other.isSubclassOf(self) | 516 || other.isSubclassOf(self) |
| 515 || compiler.world.hasAnySubclassThatMixes(self, other)) | 517 || compiler.world.hasAnySubclassThatMixes(self, other)) |
| 516 && appliesUntyped(element, compiler); | 518 && appliesUntyped(element, compiler); |
| 517 } else { | 519 } else { |
| 518 assert(mask.isSubtype); | 520 assert(mask.isSubtype); |
| 519 if (other.implementsInterface(self) | 521 if (other.implementsInterface(self) |
| 520 || other.isSubclassOf(self) | 522 || other.isSubclassOf(self) |
| 521 || compiler.world.hasAnySubclassThatMixes(self, other) | 523 || compiler.world.hasAnySubclassThatMixes(self, other) |
| 522 || compiler.world.hasAnySubclassThatImplements(other, mask.base)) { | 524 || compiler.world.hasAnySubclassThatImplements(other, mask.base)) { |
| 523 return appliesUntyped(element, compiler); | 525 return appliesUntyped(element, compiler); |
| 524 } | 526 } |
| 525 | 527 |
| 526 // If [self] is a subclass of [other], it inherits the | 528 // If [self] is a subclass of [other], it inherits the |
| 527 // implementation of [element]. | 529 // implementation of [element]. |
| 528 ClassElement cls = self; | 530 ClassElement cls = self; |
| 529 if (cls.isSubclassOf(other)) { | 531 if (cls.isSubclassOf(other)) { |
| 530 // Resolve an invocation of [element.name] on [self]. If it | 532 // Resolve an invocation of [element.name] on [self]. If it |
| 531 // is found, this selector is a candidate. | 533 // is found, this selector is a candidate. |
| 532 return hasElementIn(cls, element) && appliesUntyped(element, compiler); | 534 return hasElementIn(cls, element) && appliesUntyped(element, compiler); |
| 533 } | 535 } |
| 534 } | 536 } |
| 535 return false; | 537 return false; |
| 536 } | 538 } |
| 537 } | 539 } |
| OLD | NEW |