OLD | NEW |
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'; |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 * supertypes(C) = [S, I1, I2] ++ supertypes(S) ++ supertypes(I1) | 531 * supertypes(C) = [S, I1, I2] ++ supertypes(S) ++ supertypes(I1) |
532 * ++ supertypes(I2), | 532 * ++ supertypes(I2), |
533 * where ++ stands for list concatenation. | 533 * where ++ stands for list concatenation. |
534 * | 534 * |
535 * This order makes sure that if a class implements an interface twice with | 535 * 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 | 536 * different type arguments, the type used in the most specific class comes |
537 * first. | 537 * first. |
538 */ | 538 */ |
539 void calculateAllSupertypes(BaseClassElementX cls) { | 539 void calculateAllSupertypes(BaseClassElementX cls) { |
540 if (cls.allSupertypesAndSelf != null) return; | 540 if (cls.allSupertypesAndSelf != null) return; |
541 final ResolutionDartType supertype = cls.supertype; | 541 final ResolutionInterfaceType supertype = cls.supertype; |
542 if (supertype != null) { | 542 if (supertype != null) { |
543 cls.allSupertypesAndSelf = new OrderedTypeSetBuilder(cls, | 543 cls.allSupertypesAndSelf = new OrderedTypeSetBuilder(cls, |
544 reporter: reporter, objectType: commonElements.objectType) | 544 reporter: reporter, objectType: commonElements.objectType) |
545 .createOrderedTypeSet(supertype, cls.interfaces); | 545 .createOrderedTypeSet(supertype, cls.interfaces); |
546 } else { | 546 } else { |
547 assert(cls == resolution.commonElements.objectClass); | 547 assert(cls == resolution.commonElements.objectClass); |
548 cls.allSupertypesAndSelf = | 548 cls.allSupertypesAndSelf = |
549 new OrderedTypeSet.singleton(cls.computeType(resolution)); | 549 new OrderedTypeSet.singleton(cls.computeType(resolution)); |
550 } | 550 } |
551 } | 551 } |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 Identifier selector = node.selector.asIdentifier(); | 644 Identifier selector = node.selector.asIdentifier(); |
645 var e = prefixElement.lookupLocalMember(selector.source); | 645 var e = prefixElement.lookupLocalMember(selector.source); |
646 if (e == null || !e.impliesType) { | 646 if (e == null || !e.impliesType) { |
647 reporter.reportErrorMessage(node.selector, | 647 reporter.reportErrorMessage(node.selector, |
648 MessageKind.CANNOT_RESOLVE_TYPE, {'typeName': node.selector}); | 648 MessageKind.CANNOT_RESOLVE_TYPE, {'typeName': node.selector}); |
649 return; | 649 return; |
650 } | 650 } |
651 loadSupertype(e, node); | 651 loadSupertype(e, node); |
652 } | 652 } |
653 } | 653 } |
OLD | NEW |