| 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 /// Implementation of the element model used for deserialiation. | 5 /// Implementation of the element model used for deserialiation. |
| 6 /// | 6 /// |
| 7 /// These classes are created by [ElementDeserializer] triggered by the | 7 /// These classes are created by [ElementDeserializer] triggered by the |
| 8 /// [Deserializer]. | 8 /// [Deserializer]. |
| 9 | 9 |
| 10 library dart2js.serialization.modelz; | 10 library dart2js.serialization.modelz; |
| 11 | 11 |
| 12 import '../common.dart'; | 12 import '../common.dart'; |
| 13 import '../common/names.dart'; |
| 13 import '../common/resolution.dart' show Resolution; | 14 import '../common/resolution.dart' show Resolution; |
| 14 import '../constants/constructors.dart'; | 15 import '../constants/constructors.dart'; |
| 15 import '../constants/expressions.dart'; | 16 import '../constants/expressions.dart'; |
| 16 import '../dart_types.dart'; | 17 import '../dart_types.dart'; |
| 17 import '../elements/common.dart'; | 18 import '../elements/common.dart'; |
| 18 import '../elements/elements.dart'; | 19 import '../elements/elements.dart'; |
| 19 import '../elements/modelx.dart' show FunctionSignatureX; | 20 import '../elements/modelx.dart' show FunctionSignatureX; |
| 20 import '../elements/visitor.dart'; | 21 import '../elements/visitor.dart'; |
| 21 import '../io/source_file.dart'; | 22 import '../io/source_file.dart'; |
| 22 import '../ordered_typeset.dart'; | 23 import '../ordered_typeset.dart'; |
| (...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 @override | 766 @override |
| 766 bool get isExternal { | 767 bool get isExternal { |
| 767 return _decoder.getBool(Key.IS_EXTERNAL, | 768 return _decoder.getBool(Key.IS_EXTERNAL, |
| 768 isOptional: true, defaultValue: false); | 769 isOptional: true, defaultValue: false); |
| 769 } | 770 } |
| 770 | 771 |
| 771 @override | 772 @override |
| 772 List<DartType> get typeVariables => functionSignature.typeVariables; | 773 List<DartType> get typeVariables => functionSignature.typeVariables; |
| 773 } | 774 } |
| 774 | 775 |
| 775 abstract class ClassElementMixin implements ElementZ, ClassElement { | 776 abstract class ClassElementMixin |
| 777 implements ElementZ, ClassElement, class_members.ClassMemberMixin { |
| 778 bool _isResolved = false; |
| 779 |
| 776 InterfaceType _createType(List<DartType> typeArguments) { | 780 InterfaceType _createType(List<DartType> typeArguments) { |
| 777 return new InterfaceType(this, typeArguments); | 781 return new InterfaceType(this, typeArguments); |
| 778 } | 782 } |
| 779 | 783 |
| 780 @override | 784 @override |
| 781 ElementKind get kind => ElementKind.CLASS; | 785 ElementKind get kind => ElementKind.CLASS; |
| 782 | 786 |
| 783 @override | 787 @override |
| 784 bool get hasConstructor => _unsupported('hasConstructor'); | 788 bool get hasConstructor => _unsupported('hasConstructor'); |
| 785 | 789 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 799 return constructor; | 803 return constructor; |
| 800 } | 804 } |
| 801 return null; | 805 return null; |
| 802 } | 806 } |
| 803 | 807 |
| 804 @override | 808 @override |
| 805 ClassElement get superclass => supertype != null ? supertype.element : null; | 809 ClassElement get superclass => supertype != null ? supertype.element : null; |
| 806 | 810 |
| 807 @override | 811 @override |
| 808 void ensureResolved(Resolution resolution) { | 812 void ensureResolved(Resolution resolution) { |
| 809 resolution.registerClass(this); | 813 if (!_isResolved) { |
| 814 _isResolved = true; |
| 815 class_members.MembersCreator |
| 816 .computeClassMembersByName(resolution, this, Identifiers.call); |
| 817 resolution.registerClass(this); |
| 818 } |
| 810 } | 819 } |
| 811 } | 820 } |
| 812 | 821 |
| 813 class ClassElementZ extends DeserializedElementZ | 822 class ClassElementZ extends DeserializedElementZ |
| 814 with | 823 with |
| 815 AnalyzableElementMixin, | 824 AnalyzableElementMixin, |
| 816 AstElementMixinZ, | 825 AstElementMixinZ, |
| 817 ClassElementCommon, | 826 ClassElementCommon, |
| 818 class_members.ClassMemberMixin, | 827 class_members.ClassMemberMixin, |
| 819 ContainerMixin, | 828 ContainerMixin, |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 896 | 905 |
| 897 @override | 906 @override |
| 898 bool get isProxy => _decoder.getBool(Key.IS_PROXY); | 907 bool get isProxy => _decoder.getBool(Key.IS_PROXY); |
| 899 | 908 |
| 900 @override | 909 @override |
| 901 bool get isUnnamedMixinApplication => false; | 910 bool get isUnnamedMixinApplication => false; |
| 902 | 911 |
| 903 @override | 912 @override |
| 904 FunctionType get callType { | 913 FunctionType get callType { |
| 905 _ensureSuperHierarchy(); | 914 _ensureSuperHierarchy(); |
| 915 // TODO(johnniwinther): Why can't this always be computed in ensureResolved? |
| 906 return _callType; | 916 return _callType; |
| 907 } | 917 } |
| 908 } | 918 } |
| 909 | 919 |
| 910 abstract class MixinApplicationElementMixin | 920 abstract class MixinApplicationElementMixin |
| 911 implements ElementZ, MixinApplicationElement { | 921 implements ElementZ, MixinApplicationElement { |
| 912 @override | 922 @override |
| 913 bool get isMixinApplication => true; | 923 bool get isMixinApplication => true; |
| 914 | 924 |
| 915 @override | 925 @override |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 960 @override | 970 @override |
| 961 bool get isUnnamedMixinApplication => true; | 971 bool get isUnnamedMixinApplication => true; |
| 962 | 972 |
| 963 Link<ConstructorElement> get constructors { | 973 Link<ConstructorElement> get constructors { |
| 964 if (_constructors == null) { | 974 if (_constructors == null) { |
| 965 LinkBuilder<ConstructorElement> builder = | 975 LinkBuilder<ConstructorElement> builder = |
| 966 new LinkBuilder<ConstructorElement>(); | 976 new LinkBuilder<ConstructorElement>(); |
| 967 for (ConstructorElement definingConstructor in superclass.constructors) { | 977 for (ConstructorElement definingConstructor in superclass.constructors) { |
| 968 if (definingConstructor.isGenerativeConstructor && | 978 if (definingConstructor.isGenerativeConstructor && |
| 969 definingConstructor.memberName.isAccessibleFrom(library)) { | 979 definingConstructor.memberName.isAccessibleFrom(library)) { |
| 970 builder.addLast( | 980 ForwardingConstructorElementZ constructor = |
| 971 new ForwardingConstructorElementZ(this, definingConstructor)); | 981 new ForwardingConstructorElementZ(this, definingConstructor); |
| 982 constructor.resolvedAst = new SynthesizedResolvedAst( |
| 983 constructor, ResolvedAstKind.FORWARDING_CONSTRUCTOR); |
| 984 builder.addLast(constructor); |
| 972 } | 985 } |
| 973 } | 986 } |
| 974 _constructors = builder.toLink(); | 987 _constructors = builder.toLink(); |
| 975 } | 988 } |
| 976 return _constructors; | 989 return _constructors; |
| 977 } | 990 } |
| 978 | 991 |
| 979 @override | 992 @override |
| 980 List<DartType> _getTypeVariables() { | 993 List<DartType> _getTypeVariables() { |
| 981 // Create synthetic type variables for the mixin application. | 994 // Create synthetic type variables for the mixin application. |
| (...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2136 } | 2149 } |
| 2137 | 2150 |
| 2138 @override | 2151 @override |
| 2139 ElementKind get kind => ElementKind.PREFIX; | 2152 ElementKind get kind => ElementKind.PREFIX; |
| 2140 | 2153 |
| 2141 @override | 2154 @override |
| 2142 Element lookupLocalMember(String memberName) { | 2155 Element lookupLocalMember(String memberName) { |
| 2143 return _unsupported('lookupLocalMember'); | 2156 return _unsupported('lookupLocalMember'); |
| 2144 } | 2157 } |
| 2145 } | 2158 } |
| OLD | NEW |