| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 summary_resynthesizer; | 5 library summary_resynthesizer; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/ast/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
| (...skipping 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1278 typeArguments = const <DartType>[]; | 1278 typeArguments = const <DartType>[]; |
| 1279 } else if (numTypeArguments == numTypeParameters) { | 1279 } else if (numTypeArguments == numTypeParameters) { |
| 1280 typeArguments = new List<DartType>(numTypeParameters); | 1280 typeArguments = new List<DartType>(numTypeParameters); |
| 1281 for (int i = 0; i < numTypeParameters; i++) { | 1281 for (int i = 0; i < numTypeParameters; i++) { |
| 1282 typeArguments[i] = getTypeArgument(i); | 1282 typeArguments[i] = getTypeArgument(i); |
| 1283 } | 1283 } |
| 1284 } | 1284 } |
| 1285 InterfaceTypeImpl type = | 1285 InterfaceTypeImpl type = |
| 1286 new InterfaceTypeImpl.elementWithNameAndArgs(element, name, () { | 1286 new InterfaceTypeImpl.elementWithNameAndArgs(element, name, () { |
| 1287 if (typeArguments == null) { | 1287 if (typeArguments == null) { |
| 1288 typeArguments = element.typeParameters.map((typeParameter) { | 1288 typeArguments = element.typeParameters |
| 1289 DartType bound = typeParameter.bound; | 1289 .map/*<DartType>*/((_) => DynamicTypeImpl.instance) |
| 1290 return libraryResynthesizer.summaryResynthesizer.strongMode && | 1290 .toList(); |
| 1291 instantiateToBoundsAllowed && | 1291 if (libraryResynthesizer.summaryResynthesizer.strongMode && |
| 1292 bound != null | 1292 instantiateToBoundsAllowed) { |
| 1293 ? bound | 1293 List<DartType> typeParameterTypes; |
| 1294 : DynamicTypeImpl.instance; | 1294 for (int i = 0; i < typeArguments.length; i++) { |
| 1295 }).toList(); | 1295 DartType bound = element.typeParameters[i].bound; |
| 1296 if (bound != null) { |
| 1297 typeParameterTypes ??= element.typeParameters |
| 1298 .map/*<DartType>*/((TypeParameterElement e) => e.type) |
| 1299 .toList(); |
| 1300 typeArguments[i] = |
| 1301 bound.substitute2(typeArguments, typeParameterTypes); |
| 1302 } |
| 1303 } |
| 1304 } |
| 1296 } | 1305 } |
| 1297 return typeArguments; | 1306 return typeArguments; |
| 1298 }); | 1307 }); |
| 1299 // Mark the type as having implicit type arguments, so that we don't | 1308 // Mark the type as having implicit type arguments, so that we don't |
| 1300 // attempt to request them during constant expression resynthesizing. | 1309 // attempt to request them during constant expression resynthesizing. |
| 1301 if (typeArguments == null) { | 1310 if (typeArguments == null) { |
| 1302 libraryResynthesizer.typesWithImplicitTypeArguments.add(type); | 1311 libraryResynthesizer.typesWithImplicitTypeArguments.add(type); |
| 1303 } | 1312 } |
| 1304 // Done. | 1313 // Done. |
| 1305 return type; | 1314 return type; |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1848 static String _getElementIdentifier(String name, ReferenceKind kind) { | 1857 static String _getElementIdentifier(String name, ReferenceKind kind) { |
| 1849 if (kind == ReferenceKind.topLevelPropertyAccessor || | 1858 if (kind == ReferenceKind.topLevelPropertyAccessor || |
| 1850 kind == ReferenceKind.propertyAccessor) { | 1859 kind == ReferenceKind.propertyAccessor) { |
| 1851 if (!name.endsWith('=')) { | 1860 if (!name.endsWith('=')) { |
| 1852 return name + '?'; | 1861 return name + '?'; |
| 1853 } | 1862 } |
| 1854 } | 1863 } |
| 1855 return name; | 1864 return name; |
| 1856 } | 1865 } |
| 1857 } | 1866 } |
| OLD | NEW |