| OLD | NEW |
| 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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 _storeTypeArguments( | 214 _storeTypeArguments( |
| 215 type.typeArguments, result, compilationUnit, typeParameterContext); | 215 type.typeArguments, result, compilationUnit, typeParameterContext); |
| 216 return result; | 216 return result; |
| 217 } | 217 } |
| 218 if (element is FunctionTypeAliasElementForLink) { | 218 if (element is FunctionTypeAliasElementForLink) { |
| 219 result.reference = compilationUnit.addReference(element); | 219 result.reference = compilationUnit.addReference(element); |
| 220 _storeTypeArguments( | 220 _storeTypeArguments( |
| 221 type.typeArguments, result, compilationUnit, typeParameterContext); | 221 type.typeArguments, result, compilationUnit, typeParameterContext); |
| 222 return result; | 222 return result; |
| 223 } | 223 } |
| 224 if (element is FunctionElement && element.enclosingElement == null) { | 224 if (element is FunctionElementImpl) { |
| 225 // Element is a synthetic function element that was generated on the fly | 225 // Element is a local function, or a synthetic function element that was |
| 226 // to represent a type that has no associated source code location. | 226 // generated on the fly to represent a type that has no associated source |
| 227 result.syntheticReturnType = _createLinkedType( | 227 // code location. Store it as value. |
| 228 element.returnType, compilationUnit, typeParameterContext); | 228 result.syntheticReturnType = |
| 229 result.entityKind = | 229 _createLinkedType(element.returnType, compilationUnit, element); |
| 230 element.returnType?.element is GenericFunctionTypeElement | 230 result.entityKind = EntityRefKind.syntheticFunction; |
| 231 ? EntityRefKind.genericFunctionType | |
| 232 : EntityRefKind.syntheticFunction; | |
| 233 result.syntheticParams = element.parameters | 231 result.syntheticParams = element.parameters |
| 234 .map((ParameterElement param) => _serializeSyntheticParam( | 232 .map((ParameterElement param) => |
| 235 param, compilationUnit, typeParameterContext)) | 233 _serializeSyntheticParam(param, compilationUnit, element)) |
| 234 .toList(); |
| 235 result.typeParameters = element.typeParameters |
| 236 .map((TypeParameterElement e) => |
| 237 _serializeSyntheticTypeParameter(e, compilationUnit, element)) |
| 236 .toList(); | 238 .toList(); |
| 237 return result; | 239 return result; |
| 238 } | 240 } |
| 239 if (element is FunctionElement) { | |
| 240 // Element is a local function inside another executable. | |
| 241 result.reference = compilationUnit.addReference(element); | |
| 242 // TODO(paulberry): do I need to store type arguments? | |
| 243 return result; | |
| 244 } | |
| 245 if (element is GenericFunctionTypeElement) { | 241 if (element is GenericFunctionTypeElement) { |
| 246 result.entityKind = EntityRefKind.genericFunctionType; | 242 result.entityKind = EntityRefKind.genericFunctionType; |
| 247 result.syntheticReturnType = _createLinkedType( | 243 result.syntheticReturnType = _createLinkedType( |
| 248 type.returnType, compilationUnit, typeParameterContext); | 244 type.returnType, compilationUnit, typeParameterContext); |
| 249 result.syntheticParams = type.parameters | 245 result.syntheticParams = type.parameters |
| 250 .map((ParameterElement param) => _serializeSyntheticParam( | 246 .map((ParameterElement param) => _serializeSyntheticParam( |
| 251 param, compilationUnit, typeParameterContext)) | 247 param, compilationUnit, typeParameterContext)) |
| 252 .toList(); | 248 .toList(); |
| 253 return result; | 249 return result; |
| 254 } | 250 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 parameter, compilationUnit, typeParameterContext)) | 296 parameter, compilationUnit, typeParameterContext)) |
| 301 .toList(); | 297 .toList(); |
| 302 } else { | 298 } else { |
| 303 b.type = _createLinkedType(type, compilationUnit, typeParameterContext); | 299 b.type = _createLinkedType(type, compilationUnit, typeParameterContext); |
| 304 } | 300 } |
| 305 } | 301 } |
| 306 return b; | 302 return b; |
| 307 } | 303 } |
| 308 | 304 |
| 309 /** | 305 /** |
| 306 * Create an [UnlinkedTypeParamBuilder] representing the given [typeParameter], |
| 307 * which should be a type parameter of a synthetic function type (e.g. one |
| 308 * produced during type inference as a result of computing the least upper |
| 309 * bound of two function types). |
| 310 */ |
| 311 UnlinkedTypeParamBuilder _serializeSyntheticTypeParameter( |
| 312 TypeParameterElement typeParameter, |
| 313 CompilationUnitElementInBuildUnit compilationUnit, |
| 314 TypeParameterizedElementMixin typeParameterContext) { |
| 315 TypeParameterElementImpl impl = typeParameter as TypeParameterElementImpl; |
| 316 EntityRefBuilder boundBuilder = typeParameter.bound != null |
| 317 ? _createLinkedType( |
| 318 typeParameter.bound, compilationUnit, typeParameterContext) |
| 319 : null; |
| 320 CodeRangeBuilder codeRangeBuilder = |
| 321 new CodeRangeBuilder(offset: impl.codeOffset, length: impl.codeLength); |
| 322 return new UnlinkedTypeParamBuilder( |
| 323 name: typeParameter.name, |
| 324 nameOffset: typeParameter.nameOffset, |
| 325 bound: boundBuilder, |
| 326 codeRange: codeRangeBuilder); |
| 327 } |
| 328 |
| 329 /** |
| 310 * Store the given [typeArguments] in [encodedType], using [compilationUnit] and | 330 * Store the given [typeArguments] in [encodedType], using [compilationUnit] and |
| 311 * [typeParameterContext] to serialize them. | 331 * [typeParameterContext] to serialize them. |
| 312 */ | 332 */ |
| 313 void _storeTypeArguments( | 333 void _storeTypeArguments( |
| 314 List<DartType> typeArguments, | 334 List<DartType> typeArguments, |
| 315 EntityRefBuilder encodedType, | 335 EntityRefBuilder encodedType, |
| 316 CompilationUnitElementInBuildUnit compilationUnit, | 336 CompilationUnitElementInBuildUnit compilationUnit, |
| 317 TypeParameterizedElementMixin typeParameterContext) { | 337 TypeParameterizedElementMixin typeParameterContext) { |
| 318 int count = typeArguments.length; | 338 int count = typeArguments.length; |
| 319 List<EntityRefBuilder> encodedTypeArguments = | 339 List<EntityRefBuilder> encodedTypeArguments = |
| (...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1049 LinkedReference linkedReference = _linkedUnit.references[index]; | 1069 LinkedReference linkedReference = _linkedUnit.references[index]; |
| 1050 String name = unlinkedReference == null | 1070 String name = unlinkedReference == null |
| 1051 ? linkedReference.name | 1071 ? linkedReference.name |
| 1052 : unlinkedReference.name; | 1072 : unlinkedReference.name; |
| 1053 int containingReference = unlinkedReference == null | 1073 int containingReference = unlinkedReference == null |
| 1054 ? linkedReference.containingReference | 1074 ? linkedReference.containingReference |
| 1055 : unlinkedReference.prefixReference; | 1075 : unlinkedReference.prefixReference; |
| 1056 if (containingReference != 0 && | 1076 if (containingReference != 0 && |
| 1057 _linkedUnit.references[containingReference].kind != | 1077 _linkedUnit.references[containingReference].kind != |
| 1058 ReferenceKind.prefix) { | 1078 ReferenceKind.prefix) { |
| 1059 if (linkedReference.kind == ReferenceKind.function) { | 1079 _references[index] = |
| 1060 // Local function | 1080 resolveRef(containingReference).getContainedName(name); |
| 1061 _references[index] = resolveRef(containingReference) | |
| 1062 .getLocalFunction(linkedReference.localIndex) ?? | |
| 1063 UndefinedElementForLink.instance; | |
| 1064 } else { | |
| 1065 _references[index] = | |
| 1066 resolveRef(containingReference).getContainedName(name); | |
| 1067 } | |
| 1068 } else if (linkedReference.dependency == 0) { | 1081 } else if (linkedReference.dependency == 0) { |
| 1069 if (linkedReference.kind == ReferenceKind.unresolved) { | 1082 if (linkedReference.kind == ReferenceKind.unresolved) { |
| 1070 _references[index] = UndefinedElementForLink.instance; | 1083 _references[index] = UndefinedElementForLink.instance; |
| 1071 } else if (name == 'void') { | 1084 } else if (name == 'void') { |
| 1072 _references[index] = enclosingElement._linker.voidElement; | 1085 _references[index] = enclosingElement._linker.voidElement; |
| 1073 } else if (name == '*bottom*') { | 1086 } else if (name == '*bottom*') { |
| 1074 _references[index] = enclosingElement._linker.bottomElement; | 1087 _references[index] = enclosingElement._linker.bottomElement; |
| 1075 } else if (name == 'dynamic') { | 1088 } else if (name == 'dynamic') { |
| 1076 _references[index] = enclosingElement._linker.dynamicElement; | 1089 _references[index] = enclosingElement._linker.dynamicElement; |
| 1077 } else { | 1090 } else { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1097 } else { | 1110 } else { |
| 1098 return DynamicTypeImpl.instance; | 1111 return DynamicTypeImpl.instance; |
| 1099 } | 1112 } |
| 1100 } | 1113 } |
| 1101 if (entity.paramReference != 0) { | 1114 if (entity.paramReference != 0) { |
| 1102 return context.typeParameterContext | 1115 return context.typeParameterContext |
| 1103 .getTypeParameterType(entity.paramReference); | 1116 .getTypeParameterType(entity.paramReference); |
| 1104 } else if (entity.entityKind == EntityRefKind.genericFunctionType) { | 1117 } else if (entity.entityKind == EntityRefKind.genericFunctionType) { |
| 1105 return new GenericFunctionTypeElementForLink(this, context, entity).type; | 1118 return new GenericFunctionTypeElementForLink(this, context, entity).type; |
| 1106 } else if (entity.syntheticReturnType != null) { | 1119 } else if (entity.syntheticReturnType != null) { |
| 1107 // TODO(paulberry): implement. | 1120 FunctionElementImpl element = |
| 1108 throw new UnimplementedError(); | 1121 new FunctionElementForLink_Synthetic(this, context, entity); |
| 1122 return element.type; |
| 1109 } else if (entity.implicitFunctionTypeIndices.isNotEmpty) { | 1123 } else if (entity.implicitFunctionTypeIndices.isNotEmpty) { |
| 1110 DartType type = resolveRef(entity.reference).asStaticType; | 1124 DartType type = resolveRef(entity.reference).asStaticType; |
| 1111 for (int index in entity.implicitFunctionTypeIndices) { | 1125 for (int index in entity.implicitFunctionTypeIndices) { |
| 1112 type = (type as FunctionType).parameters[index].type; | 1126 type = (type as FunctionType).parameters[index].type; |
| 1113 } | 1127 } |
| 1114 return type; | 1128 return type; |
| 1115 } else { | 1129 } else { |
| 1116 ReferenceableElementForLink element = resolveRef(entity.reference); | 1130 ReferenceableElementForLink element = resolveRef(entity.reference); |
| 1117 | 1131 |
| 1118 DartType getTypeArgument(int i) { | 1132 DartType getTypeArgument(int i) { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1165 * If this compilation unit already has a reference in its references table | 1179 * If this compilation unit already has a reference in its references table |
| 1166 * matching [dependency], [name], [numTypeParameters], [unitNum], | 1180 * matching [dependency], [name], [numTypeParameters], [unitNum], |
| 1167 * [containingReference], and [kind], return its index. Otherwise add a new r
eference to | 1181 * [containingReference], and [kind], return its index. Otherwise add a new r
eference to |
| 1168 * the table and return its index. | 1182 * the table and return its index. |
| 1169 */ | 1183 */ |
| 1170 int addRawReference(String name, | 1184 int addRawReference(String name, |
| 1171 {int dependency: 0, | 1185 {int dependency: 0, |
| 1172 int numTypeParameters: 0, | 1186 int numTypeParameters: 0, |
| 1173 int unitNum: 0, | 1187 int unitNum: 0, |
| 1174 int containingReference: 0, | 1188 int containingReference: 0, |
| 1175 int localIndex: 0, | |
| 1176 ReferenceKind kind: ReferenceKind.classOrEnum}) { | 1189 ReferenceKind kind: ReferenceKind.classOrEnum}) { |
| 1177 List<LinkedReferenceBuilder> linkedReferences = _linkedUnit.references; | 1190 List<LinkedReferenceBuilder> linkedReferences = _linkedUnit.references; |
| 1178 List<UnlinkedReference> unlinkedReferences = _unlinkedUnit.references; | 1191 List<UnlinkedReference> unlinkedReferences = _unlinkedUnit.references; |
| 1179 for (int i = 0; i < linkedReferences.length; i++) { | 1192 for (int i = 0; i < linkedReferences.length; i++) { |
| 1180 LinkedReferenceBuilder linkedReference = linkedReferences[i]; | 1193 LinkedReferenceBuilder linkedReference = linkedReferences[i]; |
| 1181 int candidateContainingReference = i < unlinkedReferences.length | 1194 int candidateContainingReference = i < unlinkedReferences.length |
| 1182 ? unlinkedReferences[i].prefixReference | 1195 ? unlinkedReferences[i].prefixReference |
| 1183 : linkedReference.containingReference; | 1196 : linkedReference.containingReference; |
| 1184 if (candidateContainingReference != 0 && | 1197 if (candidateContainingReference != 0 && |
| 1185 linkedReferences[candidateContainingReference].kind == | 1198 linkedReferences[candidateContainingReference].kind == |
| 1186 ReferenceKind.prefix) { | 1199 ReferenceKind.prefix) { |
| 1187 // We don't need to match containing references when they are prefixes, | 1200 // We don't need to match containing references when they are prefixes, |
| 1188 // since the relevant information is in linkedReference.dependency. | 1201 // since the relevant information is in linkedReference.dependency. |
| 1189 candidateContainingReference = 0; | 1202 candidateContainingReference = 0; |
| 1190 } | 1203 } |
| 1191 if (linkedReference.dependency == dependency && | 1204 if (linkedReference.dependency == dependency && |
| 1192 (i < unlinkedReferences.length | 1205 (i < unlinkedReferences.length |
| 1193 ? unlinkedReferences[i].name | 1206 ? unlinkedReferences[i].name |
| 1194 : linkedReference.name) == | 1207 : linkedReference.name) == |
| 1195 name && | 1208 name && |
| 1196 linkedReference.numTypeParameters == numTypeParameters && | 1209 linkedReference.numTypeParameters == numTypeParameters && |
| 1197 linkedReference.unit == unitNum && | 1210 linkedReference.unit == unitNum && |
| 1198 candidateContainingReference == containingReference && | 1211 candidateContainingReference == containingReference && |
| 1199 linkedReference.kind == kind && | 1212 linkedReference.kind == kind) { |
| 1200 linkedReference.localIndex == localIndex) { | |
| 1201 return i; | 1213 return i; |
| 1202 } | 1214 } |
| 1203 } | 1215 } |
| 1204 int result = linkedReferences.length; | 1216 int result = linkedReferences.length; |
| 1205 linkedReferences.add(new LinkedReferenceBuilder( | 1217 linkedReferences.add(new LinkedReferenceBuilder( |
| 1206 dependency: dependency, | 1218 dependency: dependency, |
| 1207 name: name, | 1219 name: name, |
| 1208 numTypeParameters: numTypeParameters, | 1220 numTypeParameters: numTypeParameters, |
| 1209 unit: unitNum, | 1221 unit: unitNum, |
| 1210 containingReference: containingReference, | 1222 containingReference: containingReference, |
| 1211 kind: kind, | 1223 kind: kind)); |
| 1212 localIndex: localIndex)); | |
| 1213 return result; | 1224 return result; |
| 1214 } | 1225 } |
| 1215 | 1226 |
| 1216 /** | 1227 /** |
| 1217 * If this compilation unit already has a reference in its references table | 1228 * If this compilation unit already has a reference in its references table |
| 1218 * to [element], return its index. Otherwise add a new reference to the table | 1229 * to [element], return its index. Otherwise add a new reference to the table |
| 1219 * and return its index. | 1230 * and return its index. |
| 1220 */ | 1231 */ |
| 1221 int addReference(Element element) { | 1232 int addReference(Element element) { |
| 1222 if (element is ClassElementForLink) { | 1233 if (element is ClassElementForLink) { |
| 1223 return addRawReference(element.name, | 1234 return addRawReference(element.name, |
| 1224 dependency: library.addDependency(element.library), | 1235 dependency: library.addDependency(element.library), |
| 1225 numTypeParameters: element.typeParameters.length, | 1236 numTypeParameters: element.typeParameters.length, |
| 1226 unitNum: element.enclosingElement.unitNum); | 1237 unitNum: element.enclosingElement.unitNum); |
| 1227 } else if (element is FunctionTypeAliasElementForLink) { | 1238 } else if (element is FunctionTypeAliasElementForLink) { |
| 1228 return addRawReference(element.name, | 1239 return addRawReference(element.name, |
| 1229 dependency: library.addDependency(element.library), | 1240 dependency: library.addDependency(element.library), |
| 1230 numTypeParameters: element.typeParameters.length, | 1241 numTypeParameters: element.typeParameters.length, |
| 1231 unitNum: element.enclosingElement.unitNum, | 1242 unitNum: element.enclosingElement.unitNum, |
| 1232 kind: ReferenceKind.typedef); | 1243 kind: ReferenceKind.typedef); |
| 1233 } else if (element is FunctionElementForLink_Initializer) { | 1244 } else if (element is FunctionElementForLink_Initializer) { |
| 1234 return addRawReference('', | 1245 return addRawReference('', |
| 1235 containingReference: addReference(element.enclosingElement), | 1246 containingReference: addReference(element.enclosingElement), |
| 1236 kind: ReferenceKind.function, | 1247 kind: ReferenceKind.function); |
| 1237 localIndex: 0); | |
| 1238 } else if (element is FunctionElementForLink_Local_NonSynthetic) { | |
| 1239 ExecutableElementForLink parent = element.enclosingElement; | |
| 1240 int localIndex = parent.functions.indexOf(element); | |
| 1241 assert(localIndex != -1); | |
| 1242 return addRawReference(element.name, | |
| 1243 containingReference: addReference(parent), | |
| 1244 kind: ReferenceKind.function, | |
| 1245 localIndex: localIndex); | |
| 1246 } else if (element is ExecutableElementForLink_NonLocal) { | 1248 } else if (element is ExecutableElementForLink_NonLocal) { |
| 1247 ClassElementForLink_Class enclosingClass = element.enclosingClass; | 1249 ClassElementForLink_Class enclosingClass = element.enclosingClass; |
| 1248 ReferenceKind kind; | 1250 ReferenceKind kind; |
| 1249 switch (element._unlinkedExecutable.kind) { | 1251 switch (element._unlinkedExecutable.kind) { |
| 1250 case UnlinkedExecutableKind.functionOrMethod: | 1252 case UnlinkedExecutableKind.functionOrMethod: |
| 1251 kind = enclosingClass != null | 1253 kind = enclosingClass != null |
| 1252 ? ReferenceKind.method | 1254 ? ReferenceKind.method |
| 1253 : ReferenceKind.topLevelFunction; | 1255 : ReferenceKind.topLevelFunction; |
| 1254 break; | 1256 break; |
| 1255 case UnlinkedExecutableKind.setter: | 1257 case UnlinkedExecutableKind.setter: |
| (...skipping 1633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2889 if (_implicitFunctionTypeIndices == null) { | 2891 if (_implicitFunctionTypeIndices == null) { |
| 2890 _implicitFunctionTypeIndices = enclosingElement | 2892 _implicitFunctionTypeIndices = enclosingElement |
| 2891 .enclosingElement.implicitFunctionTypeIndices | 2893 .enclosingElement.implicitFunctionTypeIndices |
| 2892 .toList(); | 2894 .toList(); |
| 2893 _implicitFunctionTypeIndices.add(enclosingElement._parameterIndex); | 2895 _implicitFunctionTypeIndices.add(enclosingElement._parameterIndex); |
| 2894 } | 2896 } |
| 2895 return _implicitFunctionTypeIndices; | 2897 return _implicitFunctionTypeIndices; |
| 2896 } | 2898 } |
| 2897 | 2899 |
| 2898 @override | 2900 @override |
| 2901 bool get isSynthetic => true; |
| 2902 |
| 2903 @override |
| 2899 DartType get returnType { | 2904 DartType get returnType { |
| 2900 if (_returnType == null) { | 2905 if (_returnType == null) { |
| 2901 if (enclosingElement._unlinkedParam.type == null) { | 2906 if (enclosingElement._unlinkedParam.type == null) { |
| 2902 _returnType = DynamicTypeImpl.instance; | 2907 _returnType = DynamicTypeImpl.instance; |
| 2903 } else { | 2908 } else { |
| 2904 _returnType = enclosingElement.compilationUnit.resolveTypeRef( | 2909 _returnType = enclosingElement.compilationUnit.resolveTypeRef( |
| 2905 enclosingElement, enclosingElement._unlinkedParam.type); | 2910 enclosingElement, enclosingElement._unlinkedParam.type); |
| 2906 } | 2911 } |
| 2907 } | 2912 } |
| 2908 return _returnType; | 2913 return _returnType; |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3158 | 3163 |
| 3159 @override | 3164 @override |
| 3160 void _setInferredType(DartType type) { | 3165 void _setInferredType(DartType type) { |
| 3161 // TODO(paulberry): store the inferred return type in the summary. | 3166 // TODO(paulberry): store the inferred return type in the summary. |
| 3162 assert(!_hasTypeBeenInferred); | 3167 assert(!_hasTypeBeenInferred); |
| 3163 _inferredReturnType = _dynamicIfNull(type); | 3168 _inferredReturnType = _dynamicIfNull(type); |
| 3164 } | 3169 } |
| 3165 } | 3170 } |
| 3166 | 3171 |
| 3167 /** | 3172 /** |
| 3173 * Synthetic function element which is created for local functions. |
| 3174 */ |
| 3175 class FunctionElementForLink_Synthetic extends ExecutableElementForLink |
| 3176 with ReferenceableElementForLink |
| 3177 implements FunctionElementForLink_Local { |
| 3178 @override |
| 3179 final ExecutableElementForLink enclosingElement; |
| 3180 |
| 3181 final EntityRef _entityRef; |
| 3182 |
| 3183 FunctionElementForLink_Synthetic( |
| 3184 CompilationUnitElementForLink compilationUnit, |
| 3185 this.enclosingElement, |
| 3186 this._entityRef) |
| 3187 : super(compilationUnit, null); |
| 3188 |
| 3189 @override |
| 3190 TypeParameterizedElementMixin get enclosingTypeParameterContext => |
| 3191 enclosingElement; |
| 3192 |
| 3193 @override |
| 3194 DartType get returnType { |
| 3195 return _declaredReturnType ??= enclosingUnit.resynthesizerContext |
| 3196 .resolveTypeRef(this, _entityRef.syntheticReturnType); |
| 3197 } |
| 3198 |
| 3199 @override |
| 3200 List<UnlinkedParam> get unlinkedParameters => _entityRef.syntheticParams; |
| 3201 |
| 3202 @override |
| 3203 List<UnlinkedTypeParam> get unlinkedTypeParams => _entityRef.typeParameters; |
| 3204 |
| 3205 @override |
| 3206 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
| 3207 } |
| 3208 |
| 3209 /** |
| 3168 * Element representing a typedef resynthesized from a summary during linking. | 3210 * Element representing a typedef resynthesized from a summary during linking. |
| 3169 */ | 3211 */ |
| 3170 class FunctionTypeAliasElementForLink extends Object | 3212 class FunctionTypeAliasElementForLink extends Object |
| 3171 with | 3213 with |
| 3172 TypeParameterizedElementMixin, | 3214 TypeParameterizedElementMixin, |
| 3173 ParameterParentElementForLink, | 3215 ParameterParentElementForLink, |
| 3174 ReferenceableElementForLink | 3216 ReferenceableElementForLink |
| 3175 implements FunctionTypeAliasElement, ElementImpl { | 3217 implements FunctionTypeAliasElement, ElementImpl { |
| 3176 @override | 3218 @override |
| 3177 final CompilationUnitElementForLink enclosingElement; | 3219 final CompilationUnitElementForLink enclosingElement; |
| (...skipping 2144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5322 try { | 5364 try { |
| 5323 new TypeInferenceDependencyWalker().walk(_typeInferenceNode); | 5365 new TypeInferenceDependencyWalker().walk(_typeInferenceNode); |
| 5324 assert(_inferredType != null); | 5366 assert(_inferredType != null); |
| 5325 } finally { | 5367 } finally { |
| 5326 Linker._initializerTypeInferenceCycle = null; | 5368 Linker._initializerTypeInferenceCycle = null; |
| 5327 } | 5369 } |
| 5328 } else if (compilationUnit.isInBuildUnit) { | 5370 } else if (compilationUnit.isInBuildUnit) { |
| 5329 _inferredType = DynamicTypeImpl.instance; | 5371 _inferredType = DynamicTypeImpl.instance; |
| 5330 } else { | 5372 } else { |
| 5331 _inferredType = compilationUnit.getLinkedType( | 5373 _inferredType = compilationUnit.getLinkedType( |
| 5332 this, unlinkedVariable.inferredTypeSlot); | 5374 initializer, unlinkedVariable.inferredTypeSlot); |
| 5333 } | 5375 } |
| 5334 } | 5376 } |
| 5335 return _inferredType; | 5377 return _inferredType; |
| 5336 } | 5378 } |
| 5337 | 5379 |
| 5338 @override | 5380 @override |
| 5339 FunctionElementForLink_Initializer get initializer { | 5381 FunctionElementForLink_Initializer get initializer { |
| 5340 if (unlinkedVariable.initializer == null) { | 5382 if (unlinkedVariable.initializer == null) { |
| 5341 return null; | 5383 return null; |
| 5342 } else { | 5384 } else { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5407 } | 5449 } |
| 5408 | 5450 |
| 5409 /** | 5451 /** |
| 5410 * This exception is thrown when [ExprTypeComputer] cannot inference the type. | 5452 * This exception is thrown when [ExprTypeComputer] cannot inference the type. |
| 5411 */ | 5453 */ |
| 5412 class _InferenceFailedError { | 5454 class _InferenceFailedError { |
| 5413 final String message; | 5455 final String message; |
| 5414 | 5456 |
| 5415 _InferenceFailedError(this.message); | 5457 _InferenceFailedError(this.message); |
| 5416 } | 5458 } |
| OLD | NEW |