| 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(this, t)) | 727 .map((EntityRef t) => context.resolveTypeRef(t, this)) |
| 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(this, t)) | 834 .map((EntityRef t) => context.resolveTypeRef(t, this)) |
| 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(this, _unlinkedClass.supertype); | 868 .resolveTypeRef(_unlinkedClass.supertype, this); |
| 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 | 3882 _returnType = enclosingUnit.resynthesizerContext.resolveLinkedType( |
| 3883 .resolveLinkedType(this, serializedExecutable.inferredReturnTypeSlot); | 3883 serializedExecutable.inferredReturnTypeSlot, typeParameterContext); |
| 3884 _declaredReturnType = enclosingUnit.resynthesizerContext.resolveTypeRef( | 3884 _declaredReturnType = enclosingUnit.resynthesizerContext.resolveTypeRef( |
| 3885 this, serializedExecutable.returnType, | 3885 serializedExecutable.returnType, typeParameterContext, |
| 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(this, _entityRef.syntheticReturnType); | 4575 .resolveTypeRef(_entityRef.syntheticReturnType, typeParameterContext); |
| 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 this, _unlinkedTypedef.returnType, | 4739 _unlinkedTypedef.returnType, this, |
| 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 /** |
| 4862 * The declared return type of the function. | 4867 * The declared return type of the function. |
| 4863 */ | 4868 */ |
| 4864 DartType _returnType; | 4869 DartType _returnType; |
| 4865 | 4870 |
| 4866 /** | 4871 /** |
| 4867 * The elements representing the parameters of the function. | 4872 * The elements representing the parameters of the function. |
| 4868 */ | 4873 */ |
| 4869 List<ParameterElement> _parameters; | 4874 List<ParameterElement> _parameters; |
| 4870 | 4875 |
| 4871 /** | 4876 /** |
| 4872 * The type defined by this element. | 4877 * The type defined by this element. |
| 4873 */ | 4878 */ |
| 4874 FunctionType _type; | 4879 FunctionType _type; |
| 4875 | 4880 |
| 4876 /** | 4881 /** |
| 4877 * Initialize a newly created function element to have no name and the given | 4882 * Initialize a newly created function element to have no name and the given |
| 4878 * [nameOffset]. This is used for function expressions, that have no name. | 4883 * [nameOffset]. This is used for function expressions, that have no name. |
| 4879 */ | 4884 */ |
| 4880 GenericFunctionTypeElementImpl.forOffset(int nameOffset) | 4885 GenericFunctionTypeElementImpl.forOffset(int nameOffset) |
| 4881 : super("", nameOffset); | 4886 : super("", nameOffset); |
| 4882 | 4887 |
| 4883 /** | 4888 /** |
| 4884 * Initialize from serialized information. | 4889 * Initialize from serialized information. |
| 4885 */ | 4890 */ |
| 4886 GenericFunctionTypeElementImpl.forSerialized( | 4891 GenericFunctionTypeElementImpl.forSerialized( |
| 4887 ElementImpl enclosingElement, this._entityRef) | 4892 this._entityRef, this._typeParameterContext) |
| 4888 : super.forSerialized(enclosingElement); | 4893 : super.forSerialized(null); |
| 4889 | 4894 |
| 4890 @override | 4895 @override |
| 4891 TypeParameterizedElementMixin get enclosingTypeParameterContext { | 4896 TypeParameterizedElementMixin get enclosingTypeParameterContext => |
| 4892 return _enclosingElement.typeParameterContext; | 4897 _typeParameterContext ?? |
| 4893 } | 4898 (enclosingElement as ElementImpl).typeParameterContext; |
| 4894 | 4899 |
| 4895 @override | 4900 @override |
| 4896 String get identifier => '-'; | 4901 String get identifier => '-'; |
| 4897 | 4902 |
| 4898 @override | 4903 @override |
| 4899 ElementKind get kind => ElementKind.GENERIC_FUNCTION_TYPE; | 4904 ElementKind get kind => ElementKind.GENERIC_FUNCTION_TYPE; |
| 4900 | 4905 |
| 4901 @override | 4906 @override |
| 4902 List<ParameterElement> get parameters { | 4907 List<ParameterElement> get parameters { |
| 4903 if (_entityRef != null) { | 4908 if (_entityRef != null) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 4916 for (ParameterElement parameter in parameters) { | 4921 for (ParameterElement parameter in parameters) { |
| 4917 (parameter as ParameterElementImpl).enclosingElement = this; | 4922 (parameter as ParameterElementImpl).enclosingElement = this; |
| 4918 } | 4923 } |
| 4919 this._parameters = parameters; | 4924 this._parameters = parameters; |
| 4920 } | 4925 } |
| 4921 | 4926 |
| 4922 @override | 4927 @override |
| 4923 DartType get returnType { | 4928 DartType get returnType { |
| 4924 if (_entityRef != null && _returnType == null) { | 4929 if (_entityRef != null && _returnType == null) { |
| 4925 _returnType = enclosingUnit.resynthesizerContext.resolveTypeRef( | 4930 _returnType = enclosingUnit.resynthesizerContext.resolveTypeRef( |
| 4926 this, _entityRef.syntheticReturnType, | 4931 _entityRef.syntheticReturnType, typeParameterContext, |
| 4927 defaultVoid: false, declaredType: true); | 4932 defaultVoid: false, declaredType: true); |
| 4928 } | 4933 } |
| 4929 return _returnType; | 4934 return _returnType; |
| 4930 } | 4935 } |
| 4931 | 4936 |
| 4932 /** | 4937 /** |
| 4933 * Set the return type defined by this function type element to the given | 4938 * Set the return type defined by this function type element to the given |
| 4934 * [returnType]. | 4939 * [returnType]. |
| 4935 */ | 4940 */ |
| 4936 void set returnType(DartType returnType) { | 4941 void set returnType(DartType returnType) { |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5090 TypeParameterizedElementMixin get enclosingTypeParameterContext => null; | 5095 TypeParameterizedElementMixin get enclosingTypeParameterContext => null; |
| 5091 | 5096 |
| 5092 @override | 5097 @override |
| 5093 CompilationUnitElementImpl get enclosingUnit => | 5098 CompilationUnitElementImpl get enclosingUnit => |
| 5094 _enclosingElement as CompilationUnitElementImpl; | 5099 _enclosingElement as CompilationUnitElementImpl; |
| 5095 | 5100 |
| 5096 @override | 5101 @override |
| 5097 GenericFunctionTypeElement get function { | 5102 GenericFunctionTypeElement get function { |
| 5098 if (_function == null && _unlinkedTypedef != null) { | 5103 if (_function == null && _unlinkedTypedef != null) { |
| 5099 DartType type = enclosingUnit.resynthesizerContext.resolveTypeRef( | 5104 DartType type = enclosingUnit.resynthesizerContext.resolveTypeRef( |
| 5100 this, _unlinkedTypedef.returnType, | 5105 _unlinkedTypedef.returnType, this, |
| 5101 declaredType: true); | 5106 declaredType: true); |
| 5102 if (type is FunctionType) { | 5107 if (type is FunctionType) { |
| 5103 Element element = type.element; | 5108 Element element = type.element; |
| 5104 if (element is GenericFunctionTypeElement) { | 5109 if (element is GenericFunctionTypeElement) { |
| 5105 (element as GenericFunctionTypeElementImpl).enclosingElement = this; | 5110 (element as GenericFunctionTypeElementImpl).enclosingElement = this; |
| 5106 _function = element; | 5111 _function = element; |
| 5107 } | 5112 } |
| 5108 } | 5113 } |
| 5109 } | 5114 } |
| 5110 return _function; | 5115 return _function; |
| (...skipping 2157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7268 int offset = super.nameOffset; | 7273 int offset = super.nameOffset; |
| 7269 if (offset == 0 && _unlinkedVariable != null) { | 7274 if (offset == 0 && _unlinkedVariable != null) { |
| 7270 return _unlinkedVariable.nameOffset; | 7275 return _unlinkedVariable.nameOffset; |
| 7271 } | 7276 } |
| 7272 return offset; | 7277 return offset; |
| 7273 } | 7278 } |
| 7274 | 7279 |
| 7275 @override | 7280 @override |
| 7276 DartType get type { | 7281 DartType get type { |
| 7277 if (_unlinkedVariable != null && _declaredType == null && _type == null) { | 7282 if (_unlinkedVariable != null && _declaredType == null && _type == null) { |
| 7278 _type = enclosingUnit.resynthesizerContext | 7283 _type = enclosingUnit.resynthesizerContext.resolveLinkedType( |
| 7279 .resolveLinkedType(this, _unlinkedVariable.inferredTypeSlot); | 7284 _unlinkedVariable.inferredTypeSlot, typeParameterContext); |
| 7280 declaredType = enclosingUnit.resynthesizerContext | 7285 declaredType = enclosingUnit.resynthesizerContext.resolveTypeRef( |
| 7281 .resolveTypeRef(this, _unlinkedVariable.type, declaredType: true); | 7286 _unlinkedVariable.type, typeParameterContext, |
| 7287 declaredType: true); |
| 7282 } | 7288 } |
| 7283 return super.type; | 7289 return super.type; |
| 7284 } | 7290 } |
| 7285 | 7291 |
| 7286 @override | 7292 @override |
| 7287 void set type(DartType type) { | 7293 void set type(DartType type) { |
| 7288 _assertNotResynthesized(_unlinkedVariable); | 7294 _assertNotResynthesized(_unlinkedVariable); |
| 7289 _type = _checkElementOfType(type); | 7295 _type = _checkElementOfType(type); |
| 7290 } | 7296 } |
| 7291 | 7297 |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7773 List<ParameterElement> subParameters = ParameterElementImpl | 7779 List<ParameterElement> subParameters = ParameterElementImpl |
| 7774 .resynthesizeList(_unlinkedParam.parameters, this, | 7780 .resynthesizeList(_unlinkedParam.parameters, this, |
| 7775 synthetic: isSynthetic); | 7781 synthetic: isSynthetic); |
| 7776 if (isSynthetic) { | 7782 if (isSynthetic) { |
| 7777 parameterTypeElement.parameters = subParameters; | 7783 parameterTypeElement.parameters = subParameters; |
| 7778 } else { | 7784 } else { |
| 7779 _parameters = subParameters; | 7785 _parameters = subParameters; |
| 7780 parameterTypeElement.shareParameters(subParameters); | 7786 parameterTypeElement.shareParameters(subParameters); |
| 7781 } | 7787 } |
| 7782 parameterTypeElement.returnType = enclosingUnit.resynthesizerContext | 7788 parameterTypeElement.returnType = enclosingUnit.resynthesizerContext |
| 7783 .resolveTypeRef(this, _unlinkedParam.type); | 7789 .resolveTypeRef(_unlinkedParam.type, typeParameterContext); |
| 7784 FunctionTypeImpl parameterType = | 7790 FunctionTypeImpl parameterType = |
| 7785 new FunctionTypeImpl.elementWithNameAndArgs(parameterTypeElement, | 7791 new FunctionTypeImpl.elementWithNameAndArgs(parameterTypeElement, |
| 7786 null, typeParameterContext.allTypeParameterTypes, false); | 7792 null, typeParameterContext.allTypeParameterTypes, false); |
| 7787 parameterTypeElement.type = parameterType; | 7793 parameterTypeElement.type = parameterType; |
| 7788 _type = parameterType; | 7794 _type = parameterType; |
| 7789 } else { | 7795 } else { |
| 7790 _type = enclosingUnit.resynthesizerContext | 7796 _type = enclosingUnit.resynthesizerContext.resolveLinkedType( |
| 7791 .resolveLinkedType(this, _unlinkedParam.inferredTypeSlot); | 7797 _unlinkedParam.inferredTypeSlot, typeParameterContext); |
| 7792 declaredType = enclosingUnit.resynthesizerContext | 7798 declaredType = enclosingUnit.resynthesizerContext.resolveTypeRef( |
| 7793 .resolveTypeRef(this, _unlinkedParam.type, declaredType: true); | 7799 _unlinkedParam.type, typeParameterContext, |
| 7800 declaredType: true); |
| 7794 } | 7801 } |
| 7795 } | 7802 } |
| 7796 } | 7803 } |
| 7797 | 7804 |
| 7798 /** | 7805 /** |
| 7799 * Create and return [ParameterElement]s for the given [unlinkedParameters]. | 7806 * Create and return [ParameterElement]s for the given [unlinkedParameters]. |
| 7800 */ | 7807 */ |
| 7801 static List<ParameterElement> resynthesizeList( | 7808 static List<ParameterElement> resynthesizeList( |
| 7802 List<UnlinkedParam> unlinkedParameters, ElementImpl enclosingElement, | 7809 List<UnlinkedParam> unlinkedParameters, ElementImpl enclosingElement, |
| 7803 {bool synthetic: false}) { | 7810 {bool synthetic: false}) { |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8280 /** | 8287 /** |
| 8281 * Initialize using the given serialized information. | 8288 * Initialize using the given serialized information. |
| 8282 */ | 8289 */ |
| 8283 PropertyInducingElementImpl.forSerialized( | 8290 PropertyInducingElementImpl.forSerialized( |
| 8284 UnlinkedVariable unlinkedVariable, ElementImpl enclosingElement) | 8291 UnlinkedVariable unlinkedVariable, ElementImpl enclosingElement) |
| 8285 : super.forSerialized(unlinkedVariable, enclosingElement); | 8292 : super.forSerialized(unlinkedVariable, enclosingElement); |
| 8286 | 8293 |
| 8287 @override | 8294 @override |
| 8288 DartType get propagatedType { | 8295 DartType get propagatedType { |
| 8289 if (_unlinkedVariable != null && _propagatedType == null) { | 8296 if (_unlinkedVariable != null && _propagatedType == null) { |
| 8290 _propagatedType = enclosingUnit.resynthesizerContext | 8297 _propagatedType = enclosingUnit.resynthesizerContext.resolveLinkedType( |
| 8291 .resolveLinkedType(this, _unlinkedVariable.propagatedTypeSlot); | 8298 _unlinkedVariable.propagatedTypeSlot, typeParameterContext); |
| 8292 } | 8299 } |
| 8293 return _propagatedType; | 8300 return _propagatedType; |
| 8294 } | 8301 } |
| 8295 | 8302 |
| 8296 void set propagatedType(DartType propagatedType) { | 8303 void set propagatedType(DartType propagatedType) { |
| 8297 _assertNotResynthesized(_unlinkedVariable); | 8304 _assertNotResynthesized(_unlinkedVariable); |
| 8298 _propagatedType = _checkElementOfType(propagatedType); | 8305 _propagatedType = _checkElementOfType(propagatedType); |
| 8299 } | 8306 } |
| 8300 | 8307 |
| 8301 @override | 8308 @override |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8356 /** | 8363 /** |
| 8357 * Return `true` if the given const constructor [slot] is a part of a cycle. | 8364 * Return `true` if the given const constructor [slot] is a part of a cycle. |
| 8358 */ | 8365 */ |
| 8359 bool isInConstCycle(int slot); | 8366 bool isInConstCycle(int slot); |
| 8360 | 8367 |
| 8361 /** | 8368 /** |
| 8362 * Resolve an [EntityRef] into a constructor. If the reference is | 8369 * Resolve an [EntityRef] into a constructor. If the reference is |
| 8363 * unresolved, return `null`. | 8370 * unresolved, return `null`. |
| 8364 */ | 8371 */ |
| 8365 ConstructorElement resolveConstructorRef( | 8372 ConstructorElement resolveConstructorRef( |
| 8366 ElementImpl context, EntityRef entry); | 8373 TypeParameterizedElementMixin typeParameterContext, EntityRef entry); |
| 8367 | 8374 |
| 8368 /** | 8375 /** |
| 8369 * Build the appropriate [DartType] object corresponding to a slot id in the | 8376 * Build the appropriate [DartType] object corresponding to a slot id in the |
| 8370 * [LinkedUnit.types] table. | 8377 * [LinkedUnit.types] table. |
| 8371 */ | 8378 */ |
| 8372 DartType resolveLinkedType(ElementImpl context, int slot); | 8379 DartType resolveLinkedType( |
| 8380 int slot, TypeParameterizedElementMixin typeParameterContext); |
| 8373 | 8381 |
| 8374 /** | 8382 /** |
| 8375 * Resolve an [EntityRef] into a type. If the reference is | 8383 * Resolve an [EntityRef] into a type. If the reference is |
| 8376 * unresolved, return [DynamicTypeImpl.instance]. | 8384 * unresolved, return [DynamicTypeImpl.instance]. |
| 8377 * | 8385 * |
| 8378 * TODO(paulberry): or should we have a class representing an | 8386 * TODO(paulberry): or should we have a class representing an |
| 8379 * unresolved type, for consistency with the full element model? | 8387 * unresolved type, for consistency with the full element model? |
| 8380 */ | 8388 */ |
| 8381 DartType resolveTypeRef(ElementImpl context, EntityRef type, | 8389 DartType resolveTypeRef( |
| 8390 EntityRef type, TypeParameterizedElementMixin typeParameterContext, |
| 8382 {bool defaultVoid: false, | 8391 {bool defaultVoid: false, |
| 8383 bool instantiateToBoundsAllowed: true, | 8392 bool instantiateToBoundsAllowed: true, |
| 8384 bool declaredType: false}); | 8393 bool declaredType: false}); |
| 8385 } | 8394 } |
| 8386 | 8395 |
| 8387 /** | 8396 /** |
| 8388 * A concrete implementation of a [ShowElementCombinator]. | 8397 * A concrete implementation of a [ShowElementCombinator]. |
| 8389 */ | 8398 */ |
| 8390 class ShowElementCombinatorImpl implements ShowElementCombinator { | 8399 class ShowElementCombinatorImpl implements ShowElementCombinator { |
| 8391 /** | 8400 /** |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8573 super(name, -1) { | 8582 super(name, -1) { |
| 8574 isSynthetic = true; | 8583 isSynthetic = true; |
| 8575 } | 8584 } |
| 8576 | 8585 |
| 8577 DartType get bound { | 8586 DartType get bound { |
| 8578 if (_unlinkedTypeParam != null) { | 8587 if (_unlinkedTypeParam != null) { |
| 8579 if (_unlinkedTypeParam.bound == null) { | 8588 if (_unlinkedTypeParam.bound == null) { |
| 8580 return null; | 8589 return null; |
| 8581 } | 8590 } |
| 8582 return _bound ??= enclosingUnit.resynthesizerContext.resolveTypeRef( | 8591 return _bound ??= enclosingUnit.resynthesizerContext.resolveTypeRef( |
| 8583 this, _unlinkedTypeParam.bound, | 8592 _unlinkedTypeParam.bound, enclosingElement, |
| 8584 instantiateToBoundsAllowed: false, declaredType: true); | 8593 instantiateToBoundsAllowed: false, declaredType: true); |
| 8585 } | 8594 } |
| 8586 return _bound; | 8595 return _bound; |
| 8587 } | 8596 } |
| 8588 | 8597 |
| 8589 void set bound(DartType bound) { | 8598 void set bound(DartType bound) { |
| 8590 _assertNotResynthesized(_unlinkedTypeParam); | 8599 _assertNotResynthesized(_unlinkedTypeParam); |
| 8591 _bound = _checkElementOfType(bound); | 8600 _bound = _checkElementOfType(bound); |
| 8592 } | 8601 } |
| 8593 | 8602 |
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9096 | 9105 |
| 9097 @override | 9106 @override |
| 9098 void visitElement(Element element) { | 9107 void visitElement(Element element) { |
| 9099 int offset = element.nameOffset; | 9108 int offset = element.nameOffset; |
| 9100 if (offset != -1) { | 9109 if (offset != -1) { |
| 9101 map[offset] = element; | 9110 map[offset] = element; |
| 9102 } | 9111 } |
| 9103 super.visitElement(element); | 9112 super.visitElement(element); |
| 9104 } | 9113 } |
| 9105 } | 9114 } |
| OLD | NEW |