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

Side by Side Diff: pkg/compiler/lib/src/types/flat_type_mask.dart

Issue 1413613010: Normalize type masks to use the least upper instantiated subclass/type. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Fix try/poi Created 5 years, 1 month 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
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder.dart ('k') | pkg/compiler/lib/src/types/type_mask.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder.dart ('k') | pkg/compiler/lib/src/types/type_mask.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698