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

Side by Side Diff: pkg/analyzer/lib/src/summary/link.dart

Issue 2655243007: Fix for invalid 'extends/implements/with SomeEnum'. (Closed)
Patch Set: Created 3 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
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 /** 5 /**
6 * This library is capable of producing linked summaries from unlinked 6 * This library is capable of producing linked summaries from unlinked
7 * ones (or prelinked ones). It functions by building a miniature 7 * ones (or prelinked ones). It functions by building a miniature
8 * element model to represent the contents of the summaries, and then 8 * element model to represent the contents of the summaries, and then
9 * scanning the element model to gather linked information and adding 9 * scanning the element model to gather linked information and adding
10 * it to the summary data structures. 10 * it to the summary data structures.
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 } 532 }
533 533
534 @override 534 @override
535 String get identifier => name; 535 String get identifier => name;
536 536
537 @override 537 @override
538 List<InterfaceType> get interfaces => _interfaces ??= 538 List<InterfaceType> get interfaces => _interfaces ??=
539 _unlinkedClass.interfaces.map(_computeInterfaceType).toList(); 539 _unlinkedClass.interfaces.map(_computeInterfaceType).toList();
540 540
541 @override 541 @override
542 bool get isEnum => false;
543
544 @override
542 bool get isMixinApplication => _unlinkedClass.isMixinApplication; 545 bool get isMixinApplication => _unlinkedClass.isMixinApplication;
543 546
544 @override 547 @override
545 bool get isObject => _unlinkedClass.hasNoSupertype; 548 bool get isObject => _unlinkedClass.hasNoSupertype;
546 549
547 @override 550 @override
548 LibraryElementForLink get library => enclosingElement.library; 551 LibraryElementForLink get library => enclosingElement.library;
549 552
550 @override 553 @override
551 List<MethodElementForLink> get methods { 554 List<MethodElementForLink> get methods {
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 664
662 @override 665 @override
663 String toString() => '$enclosingElement.$name'; 666 String toString() => '$enclosingElement.$name';
664 667
665 /** 668 /**
666 * Convert [typeRef] into an [InterfaceType]. 669 * Convert [typeRef] into an [InterfaceType].
667 */ 670 */
668 InterfaceType _computeInterfaceType(EntityRef typeRef) { 671 InterfaceType _computeInterfaceType(EntityRef typeRef) {
669 if (typeRef != null) { 672 if (typeRef != null) {
670 DartType type = enclosingElement.resolveTypeRef(typeRef, this); 673 DartType type = enclosingElement.resolveTypeRef(typeRef, this);
671 if (type is InterfaceType) { 674 if (type is InterfaceType && !type.element.isEnum) {
Brian Wilkerson 2017/01/28 17:18:39 Then it could be used here.
672 return type; 675 return type;
673 } 676 }
674 // In the event that the `typeRef` isn't an interface type (which may 677 // In the event that the `typeRef` isn't an interface type (which may
675 // happen in the event of erroneous code) just fall through and pretend 678 // happen in the event of erroneous code) just fall through and pretend
676 // the supertype is `Object`. 679 // the supertype is `Object`.
677 } 680 }
678 return enclosingElement.enclosingElement._linker.typeProvider.objectType; 681 return enclosingElement.enclosingElement._linker.typeProvider.objectType;
679 } 682 }
680 } 683 }
681 684
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 _fields.add(new FieldElementForLink_EnumField(value, this)); 728 _fields.add(new FieldElementForLink_EnumField(value, this));
726 } 729 }
727 } 730 }
728 return _fields; 731 return _fields;
729 } 732 }
730 733
731 @override 734 @override
732 List<InterfaceType> get interfaces => const []; 735 List<InterfaceType> get interfaces => const [];
733 736
734 @override 737 @override
738 bool get isEnum => true;
739
740 @override
735 bool get isObject => false; 741 bool get isObject => false;
736 742
737 @override 743 @override
738 List<MethodElementForLink> get methods => const []; 744 List<MethodElementForLink> get methods => const [];
739 745
740 @override 746 @override
741 List<InterfaceType> get mixins => const []; 747 List<InterfaceType> get mixins => const [];
742 748
743 @override 749 @override
744 String get name => _unlinkedEnum.name; 750 String get name => _unlinkedEnum.name;
(...skipping 4238 matching lines...) Expand 10 before | Expand all | Expand 10 after
4983 * there are no type parameters in scope. 4989 * there are no type parameters in scope.
4984 */ 4990 */
4985 TypeParameterizedElementMixin get _typeParameterContext; 4991 TypeParameterizedElementMixin get _typeParameterContext;
4986 4992
4987 @override 4993 @override
4988 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); 4994 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
4989 4995
4990 @override 4996 @override
4991 String toString() => '$enclosingElement.$name'; 4997 String toString() => '$enclosingElement.$name';
4992 } 4998 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698