Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(223)

Unified Diff: pkg/analyzer/lib/src/generated/resolver.dart

Issue 2814443005: Fix for summarization of generic function type aliases and support for resynthesizing. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/dart/element/handle.dart ('k') | pkg/analyzer/lib/src/summary/idl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/resolver.dart
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index 720c8f44d1354974821ede9e353c1e2adec09e44..d3dbd3d3fde2f25c710476f740488e67670e69f2 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -8466,31 +8466,18 @@ class TypeNameResolver {
return undefinedType;
} else if (type is FunctionType) {
Element element = type.element;
- if (annotation is TypeName && element is GenericTypeAliasElement) {
- List<TypeParameterElement> parameterElements = element.typeParameters;
- FunctionType functionType = element.function.type;
- if (parameterElements.isNotEmpty) {
- List<DartType> parameterTypes =
- TypeParameterTypeImpl.getTypes(parameterElements);
- int parameterCount = parameterTypes.length;
- TypeArgumentList argumentList = annotation.typeArguments;
- List<DartType> typeArguments;
- if (argumentList != null) {
- List<TypeAnnotation> arguments = argumentList.arguments;
- int argumentCount = arguments.length;
- if (argumentCount == parameterCount) {
- typeArguments = new List<DartType>(parameterCount);
- for (int i = 0; i < parameterCount; i++) {
- typeArguments[i] = _getType(arguments[i]);
- }
- }
+ if (annotation is TypeName && element is GenericTypeAliasElementImpl) {
+ TypeArgumentList argumentList = annotation.typeArguments;
+ List<DartType> typeArguments = null;
+ if (argumentList != null) {
+ List<TypeAnnotation> arguments = argumentList.arguments;
+ int argumentCount = arguments.length;
+ typeArguments = new List<DartType>(argumentCount);
+ for (int i = 0; i < argumentCount; i++) {
+ typeArguments[i] = _getType(arguments[i]);
}
- typeArguments ??=
- new List<DartType>.filled(parameterCount, dynamicType);
- functionType =
- functionType.substitute2(typeArguments, parameterTypes);
}
- return functionType;
+ return element.typeAfterSubstitution(typeArguments);
}
}
return type;
« no previous file with comments | « pkg/analyzer/lib/src/dart/element/handle.dart ('k') | pkg/analyzer/lib/src/summary/idl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698