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

Side by Side Diff: pkg/compiler/lib/src/resolution/class_hierarchy.dart

Issue 2827283002: Implement subtype relation for kernel based elements. (Closed)
Patch Set: Add remaining checks of BackendUsage Created 3 years, 8 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
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 dart2js.resolution.class_hierarchy; 5 library dart2js.resolution.class_hierarchy;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../common/resolution.dart' show Resolution; 8 import '../common/resolution.dart' show Resolution;
9 import '../common_elements.dart' show CommonElements; 9 import '../common_elements.dart' show CommonElements;
10 import '../elements/resolution_types.dart'; 10 import '../elements/resolution_types.dart';
11 import '../elements/elements.dart'; 11 import '../elements/elements.dart';
12 import '../elements/modelx.dart' 12 import '../elements/modelx.dart'
13 show 13 show
14 BaseClassElementX, 14 BaseClassElementX,
15 ErroneousElementX, 15 ErroneousElementX,
16 MixinApplicationElementX, 16 MixinApplicationElementX,
17 SynthesizedConstructorElementX, 17 SynthesizedConstructorElementX,
18 TypeVariableElementX, 18 TypeVariableElementX,
19 UnnamedMixinApplicationElementX; 19 UnnamedMixinApplicationElementX;
20 import '../ordered_typeset.dart' show OrderedTypeSet, OrderedTypeSetBuilder; 20 import '../ordered_typeset.dart'
21 show OrderedTypeSet, ResolutionOrderedTypeSetBuilder;
21 import '../tree/tree.dart'; 22 import '../tree/tree.dart';
22 import '../universe/call_structure.dart' show CallStructure; 23 import '../universe/call_structure.dart' show CallStructure;
23 import '../universe/feature.dart' show Feature; 24 import '../universe/feature.dart' show Feature;
24 import '../util/util.dart' show Link, Setlet; 25 import '../util/util.dart' show Link, Setlet;
25 import 'enum_creator.dart'; 26 import 'enum_creator.dart';
26 import 'members.dart' show lookupInScope; 27 import 'members.dart' show lookupInScope;
27 import 'registry.dart' show ResolutionRegistry; 28 import 'registry.dart' show ResolutionRegistry;
28 import 'resolution_common.dart' show CommonResolverVisitor, MappingVisitor; 29 import 'resolution_common.dart' show CommonResolverVisitor, MappingVisitor;
29 import 'scope.dart' show Scope, TypeDeclarationScope; 30 import 'scope.dart' show Scope, TypeDeclarationScope;
30 31
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 * where ++ stands for list concatenation. 534 * where ++ stands for list concatenation.
534 * 535 *
535 * This order makes sure that if a class implements an interface twice with 536 * This order makes sure that if a class implements an interface twice with
536 * different type arguments, the type used in the most specific class comes 537 * different type arguments, the type used in the most specific class comes
537 * first. 538 * first.
538 */ 539 */
539 void calculateAllSupertypes(BaseClassElementX cls) { 540 void calculateAllSupertypes(BaseClassElementX cls) {
540 if (cls.allSupertypesAndSelf != null) return; 541 if (cls.allSupertypesAndSelf != null) return;
541 final ResolutionInterfaceType supertype = cls.supertype; 542 final ResolutionInterfaceType supertype = cls.supertype;
542 if (supertype != null) { 543 if (supertype != null) {
543 cls.allSupertypesAndSelf = new OrderedTypeSetBuilder(cls, 544 cls.allSupertypesAndSelf = new ResolutionOrderedTypeSetBuilder(cls,
544 reporter: reporter, objectType: commonElements.objectType) 545 reporter: reporter, objectType: commonElements.objectType)
545 .createOrderedTypeSet(supertype, cls.interfaces); 546 .createOrderedTypeSet(supertype, cls.interfaces);
546 } else { 547 } else {
547 assert(cls == resolution.commonElements.objectClass); 548 assert(cls == resolution.commonElements.objectClass);
548 cls.allSupertypesAndSelf = 549 cls.allSupertypesAndSelf =
549 new OrderedTypeSet.singleton(cls.computeType(resolution)); 550 new OrderedTypeSet.singleton(cls.computeType(resolution));
550 } 551 }
551 } 552 }
552 553
553 isBlackListed(ResolutionDartType type) { 554 isBlackListed(ResolutionDartType type) {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 Identifier selector = node.selector.asIdentifier(); 645 Identifier selector = node.selector.asIdentifier();
645 var e = prefixElement.lookupLocalMember(selector.source); 646 var e = prefixElement.lookupLocalMember(selector.source);
646 if (e == null || !e.impliesType) { 647 if (e == null || !e.impliesType) {
647 reporter.reportErrorMessage(node.selector, 648 reporter.reportErrorMessage(node.selector,
648 MessageKind.CANNOT_RESOLVE_TYPE, {'typeName': node.selector}); 649 MessageKind.CANNOT_RESOLVE_TYPE, {'typeName': node.selector});
649 return; 650 return;
650 } 651 }
651 loadSupertype(e, node); 652 loadSupertype(e, node);
652 } 653 }
653 } 654 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698