Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: sdk/lib/_internal/compiler/implementation/universe/universe.dart

Issue 12328035: Teach Selector.applies about mixins. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 Element self = receiverType.element; 508 Element self = receiverType.element;
509 if (self.isTypedef()) { 509 if (self.isTypedef()) {
510 // A typedef is a function type that doesn't have any 510 // A typedef is a function type that doesn't have any
511 // user-defined members. 511 // user-defined members.
512 return false; 512 return false;
513 } 513 }
514 514
515 if (typeKind == TypedSelectorKind.EXACT) { 515 if (typeKind == TypedSelectorKind.EXACT) {
516 return hasElementIn(self, element) && appliesUntyped(element, compiler); 516 return hasElementIn(self, element) && appliesUntyped(element, compiler);
517 } else if (typeKind == TypedSelectorKind.SUBCLASS) { 517 } else if (typeKind == TypedSelectorKind.SUBCLASS) {
518 return (hasElementIn(self, element) || other.isSubclassOf(self)) 518 return (hasElementIn(self, element)
519 || other.isSubclassOf(self)
520 || compiler.world.hasAnySubclassThatMixes(self, other))
519 && appliesUntyped(element, compiler); 521 && appliesUntyped(element, compiler);
520 } else { 522 } else {
521 assert(typeKind == TypedSelectorKind.INTERFACE); 523 assert(typeKind == TypedSelectorKind.INTERFACE);
522 if (other.implementsInterface(self) 524 if (other.implementsInterface(self)
523 || other.isSubclassOf(self) 525 || other.isSubclassOf(self)
526 || compiler.world.hasAnySubclassThatMixes(self, other)
524 || compiler.world.hasAnySubclassThatImplements(other, receiverType)) { 527 || compiler.world.hasAnySubclassThatImplements(other, receiverType)) {
525 return appliesUntyped(element, compiler); 528 return appliesUntyped(element, compiler);
526 } 529 }
527 530
528 // If [self] is a subclass of [other], it inherits the 531 // If [self] is a subclass of [other], it inherits the
529 // implementation of [element]. 532 // implementation of [element].
530 ClassElement cls = self; 533 ClassElement cls = self;
531 if (cls.isSubclassOf(other)) { 534 if (cls.isSubclassOf(other)) {
532 // Resolve an invocation of [element.name] on [self]. If it 535 // Resolve an invocation of [element.name] on [self]. If it
533 // is found, this selector is a candidate. 536 // is found, this selector is a candidate.
534 return hasElementIn(self, element) && appliesUntyped(element, compiler); 537 return hasElementIn(self, element) && appliesUntyped(element, compiler);
535 } 538 }
536 } 539 }
537 540
538 return false; 541 return false;
539 } 542 }
540 } 543 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698