Chromium Code Reviews| 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 ea2830a0c310c5a57327e72902da86c53332e132..5760f21810ae3dac245cd16661019fc46269cb4c 100644 |
| --- a/pkg/analyzer/lib/src/generated/resolver.dart |
| +++ b/pkg/analyzer/lib/src/generated/resolver.dart |
| @@ -8461,6 +8461,38 @@ class TypeNameResolver { |
| DartType type = annotation.type; |
| if (type == null) { |
| 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) { |
| + typeArguments = |
| + new List<DartType>.filled(parameterCount, dynamicType); |
| + } else { |
| + 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]) ?? dynamicType; |
|
scheglov
2017/04/05 00:11:56
Is this recursion?
It seems that _getType() does n
Brian Wilkerson
2017/04/05 13:23:23
Yes, but it's guaranteed to terminate because it's
|
| + } |
| + } else { |
| + typeArguments = |
| + new List<DartType>.filled(parameterCount, dynamicType); |
|
scheglov
2017/04/05 00:11:56
Could be a bit simpler with typeArguments ??= ...f
Brian Wilkerson
2017/04/05 13:23:23
Done
|
| + } |
| + } |
| + functionType = |
| + functionType.substitute2(typeArguments, parameterTypes); |
| + } |
| + return functionType; |
| + } |
| } |
| return type; |
| } |