| 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine.resolver; | 8 library engine.resolver; |
| 9 | 9 |
| 10 import 'dart:collection'; | 10 import 'dart:collection'; |
| (...skipping 15927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15938 _setElement(typeName, _dynamicType.element); | 15938 _setElement(typeName, _dynamicType.element); |
| 15939 typeName.staticType = _dynamicType; | 15939 typeName.staticType = _dynamicType; |
| 15940 node.type = _dynamicType; | 15940 node.type = _dynamicType; |
| 15941 return null; | 15941 return null; |
| 15942 } | 15942 } |
| 15943 if (argumentList != null) { | 15943 if (argumentList != null) { |
| 15944 NodeList<TypeName> arguments = argumentList.arguments; | 15944 NodeList<TypeName> arguments = argumentList.arguments; |
| 15945 int argumentCount = arguments.length; | 15945 int argumentCount = arguments.length; |
| 15946 List<DartType> parameters = _getTypeArguments(type); | 15946 List<DartType> parameters = _getTypeArguments(type); |
| 15947 int parameterCount = parameters.length; | 15947 int parameterCount = parameters.length; |
| 15948 int count = Math.min(argumentCount, parameterCount); | 15948 List<DartType> typeArguments = new List<DartType>(parameterCount); |
| 15949 List<DartType> typeArguments = new List<DartType>(); | 15949 if (argumentCount == parameterCount) { |
| 15950 for (int i = 0; i < count; i++) { | 15950 for (int i = 0; i < parameterCount; i++) { |
| 15951 DartType argumentType = _getType(arguments[i]); | 15951 TypeName argumentTypeName = arguments[i]; |
| 15952 if (argumentType != null) { | 15952 DartType argumentType = _getType(argumentTypeName); |
| 15953 typeArguments.add(argumentType); | 15953 if (argumentType == null) { |
| 15954 argumentType = _dynamicType; |
| 15955 } |
| 15956 typeArguments[i] = argumentType; |
| 15954 } | 15957 } |
| 15955 } | 15958 } else { |
| 15956 if (argumentCount != parameterCount) { | |
| 15957 reportErrorForNode(_getInvalidTypeParametersErrorCode(node), node, [type
Name.name, parameterCount, argumentCount]); | 15959 reportErrorForNode(_getInvalidTypeParametersErrorCode(node), node, [type
Name.name, parameterCount, argumentCount]); |
| 15958 } | 15960 for (int i = 0; i < parameterCount; i++) { |
| 15959 argumentCount = typeArguments.length; | 15961 typeArguments[i] = _dynamicType; |
| 15960 if (argumentCount < parameterCount) { | |
| 15961 // | |
| 15962 // If there were too many arguments, we already handled it by not adding
the values of the | |
| 15963 // extra arguments to the list. If there are too few, we handle it by ad
ding 'dynamic' | |
| 15964 // enough times to make the count equal. | |
| 15965 // | |
| 15966 for (int i = argumentCount; i < parameterCount; i++) { | |
| 15967 typeArguments.add(_dynamicType); | |
| 15968 } | 15962 } |
| 15969 } | 15963 } |
| 15970 if (type is InterfaceTypeImpl) { | 15964 if (type is InterfaceTypeImpl) { |
| 15971 InterfaceTypeImpl interfaceType = type as InterfaceTypeImpl; | 15965 InterfaceTypeImpl interfaceType = type as InterfaceTypeImpl; |
| 15972 type = interfaceType.substitute4(new List.from(typeArguments)); | 15966 type = interfaceType.substitute4(typeArguments); |
| 15973 } else if (type is FunctionTypeImpl) { | 15967 } else if (type is FunctionTypeImpl) { |
| 15974 FunctionTypeImpl functionType = type as FunctionTypeImpl; | 15968 FunctionTypeImpl functionType = type as FunctionTypeImpl; |
| 15975 type = functionType.substitute3(new List.from(typeArguments)); | 15969 type = functionType.substitute3(typeArguments); |
| 15976 } else { | 15970 } else { |
| 15977 } | 15971 } |
| 15978 } else { | 15972 } else { |
| 15979 // | 15973 // |
| 15980 // Check for the case where there are no type arguments given for a parame
terized type. | 15974 // Check for the case where there are no type arguments given for a parame
terized type. |
| 15981 // | 15975 // |
| 15982 List<DartType> parameters = _getTypeArguments(type); | 15976 List<DartType> parameters = _getTypeArguments(type); |
| 15983 int parameterCount = parameters.length; | 15977 int parameterCount = parameters.length; |
| 15984 if (parameterCount > 0) { | 15978 if (parameterCount > 0) { |
| 15985 DynamicTypeImpl dynamicType = DynamicTypeImpl.instance; | 15979 DynamicTypeImpl dynamicType = DynamicTypeImpl.instance; |
| (...skipping 7176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 23162 this.message = message; | 23156 this.message = message; |
| 23163 this.correction9 = correction; | 23157 this.correction9 = correction; |
| 23164 } | 23158 } |
| 23165 | 23159 |
| 23166 @override | 23160 @override |
| 23167 String get correction => correction9; | 23161 String get correction => correction9; |
| 23168 | 23162 |
| 23169 @override | 23163 @override |
| 23170 ErrorSeverity get errorSeverity => type.severity; | 23164 ErrorSeverity get errorSeverity => type.severity; |
| 23171 } | 23165 } |
| OLD | NEW |