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 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 } | 717 } |
718 } | 718 } |
719 return false; | 719 return false; |
720 } | 720 } |
721 | 721 |
722 @override | 722 @override |
723 List<InterfaceType> get interfaces { | 723 List<InterfaceType> get interfaces { |
724 if (_unlinkedClass != null && _interfaces == null) { | 724 if (_unlinkedClass != null && _interfaces == null) { |
725 ResynthesizerContext context = enclosingUnit.resynthesizerContext; | 725 ResynthesizerContext context = enclosingUnit.resynthesizerContext; |
726 _interfaces = _unlinkedClass.interfaces | 726 _interfaces = _unlinkedClass.interfaces |
727 .map((EntityRef t) => context.resolveTypeRef(t, this)) | 727 .map((EntityRef t) => context.resolveTypeRef(this, t)) |
728 .where(_isClassInterfaceType) | 728 .where(_isClassInterfaceType) |
729 .toList(growable: false); | 729 .toList(growable: false); |
730 } | 730 } |
731 return _interfaces ?? const <InterfaceType>[]; | 731 return _interfaces ?? const <InterfaceType>[]; |
732 } | 732 } |
733 | 733 |
734 void set interfaces(List<InterfaceType> interfaces) { | 734 void set interfaces(List<InterfaceType> interfaces) { |
735 _assertNotResynthesized(_unlinkedClass); | 735 _assertNotResynthesized(_unlinkedClass); |
736 _interfaces = interfaces; | 736 _interfaces = interfaces; |
737 } | 737 } |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
824 void set mixinApplication(bool isMixinApplication) { | 824 void set mixinApplication(bool isMixinApplication) { |
825 _assertNotResynthesized(_unlinkedClass); | 825 _assertNotResynthesized(_unlinkedClass); |
826 setModifier(Modifier.MIXIN_APPLICATION, isMixinApplication); | 826 setModifier(Modifier.MIXIN_APPLICATION, isMixinApplication); |
827 } | 827 } |
828 | 828 |
829 @override | 829 @override |
830 List<InterfaceType> get mixins { | 830 List<InterfaceType> get mixins { |
831 if (_unlinkedClass != null && _mixins == null) { | 831 if (_unlinkedClass != null && _mixins == null) { |
832 ResynthesizerContext context = enclosingUnit.resynthesizerContext; | 832 ResynthesizerContext context = enclosingUnit.resynthesizerContext; |
833 _mixins = _unlinkedClass.mixins | 833 _mixins = _unlinkedClass.mixins |
834 .map((EntityRef t) => context.resolveTypeRef(t, this)) | 834 .map((EntityRef t) => context.resolveTypeRef(this, t)) |
835 .where(_isClassInterfaceType) | 835 .where(_isClassInterfaceType) |
836 .toList(growable: false); | 836 .toList(growable: false); |
837 } | 837 } |
838 return _mixins ?? const <InterfaceType>[]; | 838 return _mixins ?? const <InterfaceType>[]; |
839 } | 839 } |
840 | 840 |
841 void set mixins(List<InterfaceType> mixins) { | 841 void set mixins(List<InterfaceType> mixins) { |
842 _assertNotResynthesized(_unlinkedClass); | 842 _assertNotResynthesized(_unlinkedClass); |
843 _mixins = mixins; | 843 _mixins = mixins; |
844 } | 844 } |
(...skipping 13 matching lines...) Expand all Loading... |
858 return _unlinkedClass.nameOffset; | 858 return _unlinkedClass.nameOffset; |
859 } | 859 } |
860 return offset; | 860 return offset; |
861 } | 861 } |
862 | 862 |
863 @override | 863 @override |
864 InterfaceType get supertype { | 864 InterfaceType get supertype { |
865 if (_unlinkedClass != null && _supertype == null) { | 865 if (_unlinkedClass != null && _supertype == null) { |
866 if (_unlinkedClass.supertype != null) { | 866 if (_unlinkedClass.supertype != null) { |
867 DartType type = enclosingUnit.resynthesizerContext | 867 DartType type = enclosingUnit.resynthesizerContext |
868 .resolveTypeRef(_unlinkedClass.supertype, this); | 868 .resolveTypeRef(this, _unlinkedClass.supertype); |
869 if (_isClassInterfaceType(type)) { | 869 if (_isClassInterfaceType(type)) { |
870 _supertype = type; | 870 _supertype = type; |
871 } else { | 871 } else { |
872 _supertype = context.typeProvider.objectType; | 872 _supertype = context.typeProvider.objectType; |
873 } | 873 } |
874 } else if (_unlinkedClass.hasNoSupertype) { | 874 } else if (_unlinkedClass.hasNoSupertype) { |
875 return null; | 875 return null; |
876 } else { | 876 } else { |
877 _supertype = context.typeProvider.objectType; | 877 _supertype = context.typeProvider.objectType; |
878 } | 878 } |
(...skipping 2993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3872 this._parameters = parameters; | 3872 this._parameters = parameters; |
3873 } | 3873 } |
3874 | 3874 |
3875 @override | 3875 @override |
3876 DartType get returnType { | 3876 DartType get returnType { |
3877 if (serializedExecutable != null && | 3877 if (serializedExecutable != null && |
3878 _declaredReturnType == null && | 3878 _declaredReturnType == null && |
3879 _returnType == null) { | 3879 _returnType == null) { |
3880 bool isSetter = | 3880 bool isSetter = |
3881 serializedExecutable.kind == UnlinkedExecutableKind.setter; | 3881 serializedExecutable.kind == UnlinkedExecutableKind.setter; |
3882 _returnType = enclosingUnit.resynthesizerContext.resolveLinkedType( | 3882 _returnType = enclosingUnit.resynthesizerContext |
3883 serializedExecutable.inferredReturnTypeSlot, typeParameterContext); | 3883 .resolveLinkedType(this, serializedExecutable.inferredReturnTypeSlot); |
3884 _declaredReturnType = enclosingUnit.resynthesizerContext.resolveTypeRef( | 3884 _declaredReturnType = enclosingUnit.resynthesizerContext.resolveTypeRef( |
3885 serializedExecutable.returnType, typeParameterContext, | 3885 this, serializedExecutable.returnType, |
3886 defaultVoid: isSetter && context.analysisOptions.strongMode, | 3886 defaultVoid: isSetter && context.analysisOptions.strongMode, |
3887 declaredType: true); | 3887 declaredType: true); |
3888 } | 3888 } |
3889 return _returnType ?? _declaredReturnType; | 3889 return _returnType ?? _declaredReturnType; |
3890 } | 3890 } |
3891 | 3891 |
3892 void set returnType(DartType returnType) { | 3892 void set returnType(DartType returnType) { |
3893 _assertNotResynthesized(serializedExecutable); | 3893 _assertNotResynthesized(serializedExecutable); |
3894 _returnType = _checkElementOfType(returnType); | 3894 _returnType = _checkElementOfType(returnType); |
3895 } | 3895 } |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4565 } | 4565 } |
4566 | 4566 |
4567 @override | 4567 @override |
4568 void set parameters(List<ParameterElement> parameters) { | 4568 void set parameters(List<ParameterElement> parameters) { |
4569 assert(false); | 4569 assert(false); |
4570 } | 4570 } |
4571 | 4571 |
4572 @override | 4572 @override |
4573 DartType get returnType { | 4573 DartType get returnType { |
4574 return _returnType ??= enclosingUnit.resynthesizerContext | 4574 return _returnType ??= enclosingUnit.resynthesizerContext |
4575 .resolveTypeRef(_entityRef.syntheticReturnType, typeParameterContext); | 4575 .resolveTypeRef(this, _entityRef.syntheticReturnType); |
4576 } | 4576 } |
4577 | 4577 |
4578 @override | 4578 @override |
4579 void set returnType(DartType returnType) { | 4579 void set returnType(DartType returnType) { |
4580 assert(false); | 4580 assert(false); |
4581 } | 4581 } |
4582 | 4582 |
4583 @override | 4583 @override |
4584 FunctionType get type { | 4584 FunctionType get type { |
4585 return _type ??= | 4585 return _type ??= |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4729 (parameter as ParameterElementImpl).enclosingElement = this; | 4729 (parameter as ParameterElementImpl).enclosingElement = this; |
4730 } | 4730 } |
4731 } | 4731 } |
4732 this._parameters = parameters; | 4732 this._parameters = parameters; |
4733 } | 4733 } |
4734 | 4734 |
4735 @override | 4735 @override |
4736 DartType get returnType { | 4736 DartType get returnType { |
4737 if (_unlinkedTypedef != null && _returnType == null) { | 4737 if (_unlinkedTypedef != null && _returnType == null) { |
4738 _returnType = enclosingUnit.resynthesizerContext.resolveTypeRef( | 4738 _returnType = enclosingUnit.resynthesizerContext.resolveTypeRef( |
4739 _unlinkedTypedef.returnType, this, | 4739 this, _unlinkedTypedef.returnType, |
4740 declaredType: true); | 4740 declaredType: true); |
4741 } | 4741 } |
4742 return _returnType; | 4742 return _returnType; |
4743 } | 4743 } |
4744 | 4744 |
4745 void set returnType(DartType returnType) { | 4745 void set returnType(DartType returnType) { |
4746 _assertNotResynthesized(_unlinkedTypedef); | 4746 _assertNotResynthesized(_unlinkedTypedef); |
4747 _returnType = _checkElementOfType(returnType); | 4747 _returnType = _checkElementOfType(returnType); |
4748 } | 4748 } |
4749 | 4749 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4852 */ | 4852 */ |
4853 class GenericFunctionTypeElementImpl extends ElementImpl | 4853 class GenericFunctionTypeElementImpl extends ElementImpl |
4854 with TypeParameterizedElementMixin | 4854 with TypeParameterizedElementMixin |
4855 implements GenericFunctionTypeElement { | 4855 implements GenericFunctionTypeElement { |
4856 /** | 4856 /** |
4857 * The unlinked representation of the generic function type in the summary. | 4857 * The unlinked representation of the generic function type in the summary. |
4858 */ | 4858 */ |
4859 EntityRef _entityRef; | 4859 EntityRef _entityRef; |
4860 | 4860 |
4861 /** | 4861 /** |
4862 * The enclosing type parameter context. | |
4863 */ | |
4864 TypeParameterizedElementMixin _typeParameterContext; | |
4865 | |
4866 /** | |
4867 * The declared return type of the function. | 4862 * The declared return type of the function. |
4868 */ | 4863 */ |
4869 DartType _returnType; | 4864 DartType _returnType; |
4870 | 4865 |
4871 /** | 4866 /** |
4872 * The elements representing the parameters of the function. | 4867 * The elements representing the parameters of the function. |
4873 */ | 4868 */ |
4874 List<ParameterElement> _parameters; | 4869 List<ParameterElement> _parameters; |
4875 | 4870 |
4876 /** | 4871 /** |
4877 * The type defined by this element. | 4872 * The type defined by this element. |
4878 */ | 4873 */ |
4879 FunctionType _type; | 4874 FunctionType _type; |
4880 | 4875 |
4881 /** | 4876 /** |
4882 * Initialize a newly created function element to have no name and the given | 4877 * Initialize a newly created function element to have no name and the given |
4883 * [nameOffset]. This is used for function expressions, that have no name. | 4878 * [nameOffset]. This is used for function expressions, that have no name. |
4884 */ | 4879 */ |
4885 GenericFunctionTypeElementImpl.forOffset(int nameOffset) | 4880 GenericFunctionTypeElementImpl.forOffset(int nameOffset) |
4886 : super("", nameOffset); | 4881 : super("", nameOffset); |
4887 | 4882 |
4888 /** | 4883 /** |
4889 * Initialize from serialized information. | 4884 * Initialize from serialized information. |
4890 */ | 4885 */ |
4891 GenericFunctionTypeElementImpl.forSerialized( | 4886 GenericFunctionTypeElementImpl.forSerialized( |
4892 this._entityRef, this._typeParameterContext) | 4887 ElementImpl enclosingElement, this._entityRef) |
4893 : super.forSerialized(null); | 4888 : super.forSerialized(enclosingElement); |
4894 | 4889 |
4895 @override | 4890 @override |
4896 TypeParameterizedElementMixin get enclosingTypeParameterContext => | 4891 TypeParameterizedElementMixin get enclosingTypeParameterContext { |
4897 _typeParameterContext ?? | 4892 return _enclosingElement.typeParameterContext; |
4898 (enclosingElement as ElementImpl).typeParameterContext; | 4893 } |
4899 | 4894 |
4900 @override | 4895 @override |
4901 String get identifier => '-'; | 4896 String get identifier => '-'; |
4902 | 4897 |
4903 @override | 4898 @override |
4904 ElementKind get kind => ElementKind.GENERIC_FUNCTION_TYPE; | 4899 ElementKind get kind => ElementKind.GENERIC_FUNCTION_TYPE; |
4905 | 4900 |
4906 @override | 4901 @override |
4907 List<ParameterElement> get parameters { | 4902 List<ParameterElement> get parameters { |
4908 if (_entityRef != null) { | 4903 if (_entityRef != null) { |
(...skipping 12 matching lines...) Expand all Loading... |
4921 for (ParameterElement parameter in parameters) { | 4916 for (ParameterElement parameter in parameters) { |
4922 (parameter as ParameterElementImpl).enclosingElement = this; | 4917 (parameter as ParameterElementImpl).enclosingElement = this; |
4923 } | 4918 } |
4924 this._parameters = parameters; | 4919 this._parameters = parameters; |
4925 } | 4920 } |
4926 | 4921 |
4927 @override | 4922 @override |
4928 DartType get returnType { | 4923 DartType get returnType { |
4929 if (_entityRef != null && _returnType == null) { | 4924 if (_entityRef != null && _returnType == null) { |
4930 _returnType = enclosingUnit.resynthesizerContext.resolveTypeRef( | 4925 _returnType = enclosingUnit.resynthesizerContext.resolveTypeRef( |
4931 _entityRef.syntheticReturnType, typeParameterContext, | 4926 this, _entityRef.syntheticReturnType, |
4932 defaultVoid: false, declaredType: true); | 4927 defaultVoid: false, declaredType: true); |
4933 } | 4928 } |
4934 return _returnType; | 4929 return _returnType; |
4935 } | 4930 } |
4936 | 4931 |
4937 /** | 4932 /** |
4938 * Set the return type defined by this function type element to the given | 4933 * Set the return type defined by this function type element to the given |
4939 * [returnType]. | 4934 * [returnType]. |
4940 */ | 4935 */ |
4941 void set returnType(DartType returnType) { | 4936 void set returnType(DartType returnType) { |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5095 TypeParameterizedElementMixin get enclosingTypeParameterContext => null; | 5090 TypeParameterizedElementMixin get enclosingTypeParameterContext => null; |
5096 | 5091 |
5097 @override | 5092 @override |
5098 CompilationUnitElementImpl get enclosingUnit => | 5093 CompilationUnitElementImpl get enclosingUnit => |
5099 _enclosingElement as CompilationUnitElementImpl; | 5094 _enclosingElement as CompilationUnitElementImpl; |
5100 | 5095 |
5101 @override | 5096 @override |
5102 GenericFunctionTypeElement get function { | 5097 GenericFunctionTypeElement get function { |
5103 if (_function == null && _unlinkedTypedef != null) { | 5098 if (_function == null && _unlinkedTypedef != null) { |
5104 DartType type = enclosingUnit.resynthesizerContext.resolveTypeRef( | 5099 DartType type = enclosingUnit.resynthesizerContext.resolveTypeRef( |
5105 _unlinkedTypedef.returnType, this, | 5100 this, _unlinkedTypedef.returnType, |
5106 declaredType: true); | 5101 declaredType: true); |
5107 if (type is FunctionType) { | 5102 if (type is FunctionType) { |
5108 Element element = type.element; | 5103 Element element = type.element; |
5109 if (element is GenericFunctionTypeElement) { | 5104 if (element is GenericFunctionTypeElement) { |
5110 (element as GenericFunctionTypeElementImpl).enclosingElement = this; | 5105 (element as GenericFunctionTypeElementImpl).enclosingElement = this; |
5111 _function = element; | 5106 _function = element; |
5112 } | 5107 } |
5113 } | 5108 } |
5114 } | 5109 } |
5115 return _function; | 5110 return _function; |
(...skipping 2157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7273 int offset = super.nameOffset; | 7268 int offset = super.nameOffset; |
7274 if (offset == 0 && _unlinkedVariable != null) { | 7269 if (offset == 0 && _unlinkedVariable != null) { |
7275 return _unlinkedVariable.nameOffset; | 7270 return _unlinkedVariable.nameOffset; |
7276 } | 7271 } |
7277 return offset; | 7272 return offset; |
7278 } | 7273 } |
7279 | 7274 |
7280 @override | 7275 @override |
7281 DartType get type { | 7276 DartType get type { |
7282 if (_unlinkedVariable != null && _declaredType == null && _type == null) { | 7277 if (_unlinkedVariable != null && _declaredType == null && _type == null) { |
7283 _type = enclosingUnit.resynthesizerContext.resolveLinkedType( | 7278 _type = enclosingUnit.resynthesizerContext |
7284 _unlinkedVariable.inferredTypeSlot, typeParameterContext); | 7279 .resolveLinkedType(this, _unlinkedVariable.inferredTypeSlot); |
7285 declaredType = enclosingUnit.resynthesizerContext.resolveTypeRef( | 7280 declaredType = enclosingUnit.resynthesizerContext |
7286 _unlinkedVariable.type, typeParameterContext, | 7281 .resolveTypeRef(this, _unlinkedVariable.type, declaredType: true); |
7287 declaredType: true); | |
7288 } | 7282 } |
7289 return super.type; | 7283 return super.type; |
7290 } | 7284 } |
7291 | 7285 |
7292 @override | 7286 @override |
7293 void set type(DartType type) { | 7287 void set type(DartType type) { |
7294 _assertNotResynthesized(_unlinkedVariable); | 7288 _assertNotResynthesized(_unlinkedVariable); |
7295 _type = _checkElementOfType(type); | 7289 _type = _checkElementOfType(type); |
7296 } | 7290 } |
7297 | 7291 |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7779 List<ParameterElement> subParameters = ParameterElementImpl | 7773 List<ParameterElement> subParameters = ParameterElementImpl |
7780 .resynthesizeList(_unlinkedParam.parameters, this, | 7774 .resynthesizeList(_unlinkedParam.parameters, this, |
7781 synthetic: isSynthetic); | 7775 synthetic: isSynthetic); |
7782 if (isSynthetic) { | 7776 if (isSynthetic) { |
7783 parameterTypeElement.parameters = subParameters; | 7777 parameterTypeElement.parameters = subParameters; |
7784 } else { | 7778 } else { |
7785 _parameters = subParameters; | 7779 _parameters = subParameters; |
7786 parameterTypeElement.shareParameters(subParameters); | 7780 parameterTypeElement.shareParameters(subParameters); |
7787 } | 7781 } |
7788 parameterTypeElement.returnType = enclosingUnit.resynthesizerContext | 7782 parameterTypeElement.returnType = enclosingUnit.resynthesizerContext |
7789 .resolveTypeRef(_unlinkedParam.type, typeParameterContext); | 7783 .resolveTypeRef(this, _unlinkedParam.type); |
7790 FunctionTypeImpl parameterType = | 7784 FunctionTypeImpl parameterType = |
7791 new FunctionTypeImpl.elementWithNameAndArgs(parameterTypeElement, | 7785 new FunctionTypeImpl.elementWithNameAndArgs(parameterTypeElement, |
7792 null, typeParameterContext.allTypeParameterTypes, false); | 7786 null, typeParameterContext.allTypeParameterTypes, false); |
7793 parameterTypeElement.type = parameterType; | 7787 parameterTypeElement.type = parameterType; |
7794 _type = parameterType; | 7788 _type = parameterType; |
7795 } else { | 7789 } else { |
7796 _type = enclosingUnit.resynthesizerContext.resolveLinkedType( | 7790 _type = enclosingUnit.resynthesizerContext |
7797 _unlinkedParam.inferredTypeSlot, typeParameterContext); | 7791 .resolveLinkedType(this, _unlinkedParam.inferredTypeSlot); |
7798 declaredType = enclosingUnit.resynthesizerContext.resolveTypeRef( | 7792 declaredType = enclosingUnit.resynthesizerContext |
7799 _unlinkedParam.type, typeParameterContext, | 7793 .resolveTypeRef(this, _unlinkedParam.type, declaredType: true); |
7800 declaredType: true); | |
7801 } | 7794 } |
7802 } | 7795 } |
7803 } | 7796 } |
7804 | 7797 |
7805 /** | 7798 /** |
7806 * Create and return [ParameterElement]s for the given [unlinkedParameters]. | 7799 * Create and return [ParameterElement]s for the given [unlinkedParameters]. |
7807 */ | 7800 */ |
7808 static List<ParameterElement> resynthesizeList( | 7801 static List<ParameterElement> resynthesizeList( |
7809 List<UnlinkedParam> unlinkedParameters, ElementImpl enclosingElement, | 7802 List<UnlinkedParam> unlinkedParameters, ElementImpl enclosingElement, |
7810 {bool synthetic: false}) { | 7803 {bool synthetic: false}) { |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8287 /** | 8280 /** |
8288 * Initialize using the given serialized information. | 8281 * Initialize using the given serialized information. |
8289 */ | 8282 */ |
8290 PropertyInducingElementImpl.forSerialized( | 8283 PropertyInducingElementImpl.forSerialized( |
8291 UnlinkedVariable unlinkedVariable, ElementImpl enclosingElement) | 8284 UnlinkedVariable unlinkedVariable, ElementImpl enclosingElement) |
8292 : super.forSerialized(unlinkedVariable, enclosingElement); | 8285 : super.forSerialized(unlinkedVariable, enclosingElement); |
8293 | 8286 |
8294 @override | 8287 @override |
8295 DartType get propagatedType { | 8288 DartType get propagatedType { |
8296 if (_unlinkedVariable != null && _propagatedType == null) { | 8289 if (_unlinkedVariable != null && _propagatedType == null) { |
8297 _propagatedType = enclosingUnit.resynthesizerContext.resolveLinkedType( | 8290 _propagatedType = enclosingUnit.resynthesizerContext |
8298 _unlinkedVariable.propagatedTypeSlot, typeParameterContext); | 8291 .resolveLinkedType(this, _unlinkedVariable.propagatedTypeSlot); |
8299 } | 8292 } |
8300 return _propagatedType; | 8293 return _propagatedType; |
8301 } | 8294 } |
8302 | 8295 |
8303 void set propagatedType(DartType propagatedType) { | 8296 void set propagatedType(DartType propagatedType) { |
8304 _assertNotResynthesized(_unlinkedVariable); | 8297 _assertNotResynthesized(_unlinkedVariable); |
8305 _propagatedType = _checkElementOfType(propagatedType); | 8298 _propagatedType = _checkElementOfType(propagatedType); |
8306 } | 8299 } |
8307 | 8300 |
8308 @override | 8301 @override |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8363 /** | 8356 /** |
8364 * Return `true` if the given const constructor [slot] is a part of a cycle. | 8357 * Return `true` if the given const constructor [slot] is a part of a cycle. |
8365 */ | 8358 */ |
8366 bool isInConstCycle(int slot); | 8359 bool isInConstCycle(int slot); |
8367 | 8360 |
8368 /** | 8361 /** |
8369 * Resolve an [EntityRef] into a constructor. If the reference is | 8362 * Resolve an [EntityRef] into a constructor. If the reference is |
8370 * unresolved, return `null`. | 8363 * unresolved, return `null`. |
8371 */ | 8364 */ |
8372 ConstructorElement resolveConstructorRef( | 8365 ConstructorElement resolveConstructorRef( |
8373 TypeParameterizedElementMixin typeParameterContext, EntityRef entry); | 8366 ElementImpl context, EntityRef entry); |
8374 | 8367 |
8375 /** | 8368 /** |
8376 * Build the appropriate [DartType] object corresponding to a slot id in the | 8369 * Build the appropriate [DartType] object corresponding to a slot id in the |
8377 * [LinkedUnit.types] table. | 8370 * [LinkedUnit.types] table. |
8378 */ | 8371 */ |
8379 DartType resolveLinkedType( | 8372 DartType resolveLinkedType(ElementImpl context, int slot); |
8380 int slot, TypeParameterizedElementMixin typeParameterContext); | |
8381 | 8373 |
8382 /** | 8374 /** |
8383 * Resolve an [EntityRef] into a type. If the reference is | 8375 * Resolve an [EntityRef] into a type. If the reference is |
8384 * unresolved, return [DynamicTypeImpl.instance]. | 8376 * unresolved, return [DynamicTypeImpl.instance]. |
8385 * | 8377 * |
8386 * TODO(paulberry): or should we have a class representing an | 8378 * TODO(paulberry): or should we have a class representing an |
8387 * unresolved type, for consistency with the full element model? | 8379 * unresolved type, for consistency with the full element model? |
8388 */ | 8380 */ |
8389 DartType resolveTypeRef( | 8381 DartType resolveTypeRef(ElementImpl context, EntityRef type, |
8390 EntityRef type, TypeParameterizedElementMixin typeParameterContext, | |
8391 {bool defaultVoid: false, | 8382 {bool defaultVoid: false, |
8392 bool instantiateToBoundsAllowed: true, | 8383 bool instantiateToBoundsAllowed: true, |
8393 bool declaredType: false}); | 8384 bool declaredType: false}); |
8394 } | 8385 } |
8395 | 8386 |
8396 /** | 8387 /** |
8397 * A concrete implementation of a [ShowElementCombinator]. | 8388 * A concrete implementation of a [ShowElementCombinator]. |
8398 */ | 8389 */ |
8399 class ShowElementCombinatorImpl implements ShowElementCombinator { | 8390 class ShowElementCombinatorImpl implements ShowElementCombinator { |
8400 /** | 8391 /** |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8582 super(name, -1) { | 8573 super(name, -1) { |
8583 isSynthetic = true; | 8574 isSynthetic = true; |
8584 } | 8575 } |
8585 | 8576 |
8586 DartType get bound { | 8577 DartType get bound { |
8587 if (_unlinkedTypeParam != null) { | 8578 if (_unlinkedTypeParam != null) { |
8588 if (_unlinkedTypeParam.bound == null) { | 8579 if (_unlinkedTypeParam.bound == null) { |
8589 return null; | 8580 return null; |
8590 } | 8581 } |
8591 return _bound ??= enclosingUnit.resynthesizerContext.resolveTypeRef( | 8582 return _bound ??= enclosingUnit.resynthesizerContext.resolveTypeRef( |
8592 _unlinkedTypeParam.bound, enclosingElement, | 8583 this, _unlinkedTypeParam.bound, |
8593 instantiateToBoundsAllowed: false, declaredType: true); | 8584 instantiateToBoundsAllowed: false, declaredType: true); |
8594 } | 8585 } |
8595 return _bound; | 8586 return _bound; |
8596 } | 8587 } |
8597 | 8588 |
8598 void set bound(DartType bound) { | 8589 void set bound(DartType bound) { |
8599 _assertNotResynthesized(_unlinkedTypeParam); | 8590 _assertNotResynthesized(_unlinkedTypeParam); |
8600 _bound = _checkElementOfType(bound); | 8591 _bound = _checkElementOfType(bound); |
8601 } | 8592 } |
8602 | 8593 |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9105 | 9096 |
9106 @override | 9097 @override |
9107 void visitElement(Element element) { | 9098 void visitElement(Element element) { |
9108 int offset = element.nameOffset; | 9099 int offset = element.nameOffset; |
9109 if (offset != -1) { | 9100 if (offset != -1) { |
9110 map[offset] = element; | 9101 map[offset] = element; |
9111 } | 9102 } |
9112 super.visitElement(element); | 9103 super.visitElement(element); |
9113 } | 9104 } |
9114 } | 9105 } |
OLD | NEW |