| 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 masks; | 5 part of masks; |
| 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 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 if (isExact && closedWorld.isAbstract(base)) return false; | 566 if (isExact && closedWorld.isAbstract(base)) return false; |
| 567 | 567 |
| 568 return closedWorld.needsNoSuchMethod( | 568 return closedWorld.needsNoSuchMethod( |
| 569 base, | 569 base, |
| 570 selector, | 570 selector, |
| 571 isExact | 571 isExact |
| 572 ? ClassQuery.EXACT | 572 ? ClassQuery.EXACT |
| 573 : (isSubclass ? ClassQuery.SUBCLASS : ClassQuery.SUBTYPE)); | 573 : (isSubclass ? ClassQuery.SUBCLASS : ClassQuery.SUBTYPE)); |
| 574 } | 574 } |
| 575 | 575 |
| 576 Element locateSingleElement(Selector selector, Compiler compiler) { | 576 Element locateSingleElement(Selector selector, ClosedWorld closedWorld) { |
| 577 if (isEmptyOrNull) return null; | 577 if (isEmptyOrNull) return null; |
| 578 Iterable<Element> targets = | 578 Iterable<Element> targets = closedWorld.allFunctions.filter(selector, this); |
| 579 compiler.closedWorld.allFunctions.filter(selector, this); | |
| 580 if (targets.length != 1) return null; | 579 if (targets.length != 1) return null; |
| 581 Element result = targets.first; | 580 Element result = targets.first; |
| 582 ClassElement enclosing = result.enclosingClass.declaration; | 581 ClassElement enclosing = result.enclosingClass.declaration; |
| 583 // We only return the found element if it is guaranteed to be implemented on | 582 // We only return the found element if it is guaranteed to be implemented on |
| 584 // all classes in the receiver type [this]. It could be found only in a | 583 // all classes in the receiver type [this]. It could be found only in a |
| 585 // subclass or in an inheritance-wise unrelated class in case of subtype | 584 // subclass or in an inheritance-wise unrelated class in case of subtype |
| 586 // selectors. | 585 // selectors. |
| 587 ClosedWorld closedWorld = compiler.closedWorld; | |
| 588 if (isSubtype) { | 586 if (isSubtype) { |
| 589 // if (closedWorld.isUsedAsMixin(enclosing)) { | 587 // if (closedWorld.isUsedAsMixin(enclosing)) { |
| 590 if (closedWorld.everySubtypeIsSubclassOfOrMixinUseOf(base, enclosing)) { | 588 if (closedWorld.everySubtypeIsSubclassOfOrMixinUseOf(base, enclosing)) { |
| 591 return result; | 589 return result; |
| 592 } | 590 } |
| 593 //} | 591 //} |
| 594 return null; | 592 return null; |
| 595 } else { | 593 } else { |
| 596 if (closedWorld.isSubclassOf(base, enclosing)) return result; | 594 if (closedWorld.isSubclassOf(base, enclosing)) return result; |
| 597 if (closedWorld.isSubclassOfMixinUseOf(base, enclosing)) return result; | 595 if (closedWorld.isSubclassOfMixinUseOf(base, enclosing)) return result; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 if (x.isExact) { | 634 if (x.isExact) { |
| 637 return null; | 635 return null; |
| 638 } else if (x.isSubclass) { | 636 } else if (x.isSubclass) { |
| 639 return closedWorld.strictSubclassesOf(element); | 637 return closedWorld.strictSubclassesOf(element); |
| 640 } else { | 638 } else { |
| 641 assert(x.isSubtype); | 639 assert(x.isSubtype); |
| 642 return closedWorld.strictSubtypesOf(element); | 640 return closedWorld.strictSubtypesOf(element); |
| 643 } | 641 } |
| 644 } | 642 } |
| 645 } | 643 } |
| OLD | NEW |