OLD | NEW |
---|---|
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 analyzer.src.dart.element.element; | 5 library analyzer.src.dart.element.element; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 import 'dart:math' show min; | 8 import 'dart:math' show min; |
9 | 9 |
10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
736 } | 736 } |
737 return false; | 737 return false; |
738 } | 738 } |
739 | 739 |
740 @override | 740 @override |
741 List<InterfaceType> get interfaces { | 741 List<InterfaceType> get interfaces { |
742 if (_unlinkedClass != null && _interfaces == null) { | 742 if (_unlinkedClass != null && _interfaces == null) { |
743 ResynthesizerContext context = enclosingUnit.resynthesizerContext; | 743 ResynthesizerContext context = enclosingUnit.resynthesizerContext; |
744 _interfaces = _unlinkedClass.interfaces | 744 _interfaces = _unlinkedClass.interfaces |
745 .map((EntityRef t) => context.resolveTypeRef(t, this)) | 745 .map((EntityRef t) => context.resolveTypeRef(t, this)) |
746 .where((DartType type) => type is InterfaceType) | |
746 .toList(growable: false); | 747 .toList(growable: false); |
747 } | 748 } |
748 return _interfaces ?? const <InterfaceType>[]; | 749 return _interfaces ?? const <InterfaceType>[]; |
749 } | 750 } |
750 | 751 |
751 void set interfaces(List<InterfaceType> interfaces) { | 752 void set interfaces(List<InterfaceType> interfaces) { |
752 assert(_unlinkedClass == null); | 753 assert(_unlinkedClass == null); |
753 _interfaces = interfaces; | 754 _interfaces = interfaces; |
754 } | 755 } |
755 | 756 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
842 assert(_unlinkedClass == null); | 843 assert(_unlinkedClass == null); |
843 setModifier(Modifier.MIXIN_APPLICATION, isMixinApplication); | 844 setModifier(Modifier.MIXIN_APPLICATION, isMixinApplication); |
844 } | 845 } |
845 | 846 |
846 @override | 847 @override |
847 List<InterfaceType> get mixins { | 848 List<InterfaceType> get mixins { |
848 if (_unlinkedClass != null && _mixins == null) { | 849 if (_unlinkedClass != null && _mixins == null) { |
849 ResynthesizerContext context = enclosingUnit.resynthesizerContext; | 850 ResynthesizerContext context = enclosingUnit.resynthesizerContext; |
850 _mixins = _unlinkedClass.mixins | 851 _mixins = _unlinkedClass.mixins |
851 .map((EntityRef t) => context.resolveTypeRef(t, this)) | 852 .map((EntityRef t) => context.resolveTypeRef(t, this)) |
853 .where((DartType type) => type is InterfaceType) | |
852 .toList(growable: false); | 854 .toList(growable: false); |
853 } | 855 } |
854 return _mixins ?? const <InterfaceType>[]; | 856 return _mixins ?? const <InterfaceType>[]; |
855 } | 857 } |
856 | 858 |
857 void set mixins(List<InterfaceType> mixins) { | 859 void set mixins(List<InterfaceType> mixins) { |
858 assert(_unlinkedClass == null); | 860 assert(_unlinkedClass == null); |
859 _mixins = mixins; | 861 _mixins = mixins; |
860 } | 862 } |
861 | 863 |
(...skipping 10 matching lines...) Expand all Loading... | |
872 if (_unlinkedClass != null) { | 874 if (_unlinkedClass != null) { |
873 return _unlinkedClass.nameOffset; | 875 return _unlinkedClass.nameOffset; |
874 } | 876 } |
875 return super.nameOffset; | 877 return super.nameOffset; |
876 } | 878 } |
877 | 879 |
878 @override | 880 @override |
879 InterfaceType get supertype { | 881 InterfaceType get supertype { |
880 if (_unlinkedClass != null && _supertype == null) { | 882 if (_unlinkedClass != null && _supertype == null) { |
881 if (_unlinkedClass.supertype != null) { | 883 if (_unlinkedClass.supertype != null) { |
882 _supertype = enclosingUnit.resynthesizerContext | 884 _supertype = enclosingUnit.resynthesizerContext |
Brian Wilkerson
2016/09/09 18:26:28
Does this need to check that the supertype is an I
scheglov
2016/09/09 18:44:47
You are right, it does.
Done.
| |
883 .resolveTypeRef(_unlinkedClass.supertype, this); | 885 .resolveTypeRef(_unlinkedClass.supertype, this); |
884 } else if (_unlinkedClass.hasNoSupertype) { | 886 } else if (_unlinkedClass.hasNoSupertype) { |
885 return null; | 887 return null; |
886 } else { | 888 } else { |
887 _supertype = context.typeProvider.objectType; | 889 _supertype = context.typeProvider.objectType; |
888 } | 890 } |
889 } | 891 } |
890 return _supertype; | 892 return _supertype; |
891 } | 893 } |
892 | 894 |
(...skipping 7611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8504 | 8506 |
8505 @override | 8507 @override |
8506 void visitElement(Element element) { | 8508 void visitElement(Element element) { |
8507 int offset = element.nameOffset; | 8509 int offset = element.nameOffset; |
8508 if (offset != -1) { | 8510 if (offset != -1) { |
8509 map[offset] = element; | 8511 map[offset] = element; |
8510 } | 8512 } |
8511 super.visitElement(element); | 8513 super.visitElement(element); |
8512 } | 8514 } |
8513 } | 8515 } |
OLD | NEW |