| 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/standard_ast_factory.dart'; | 10 import 'package:analyzer/dart/ast/standard_ast_factory.dart'; |
| (...skipping 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1241 * is returned. | 1241 * is returned. |
| 1242 */ | 1242 */ |
| 1243 DartType buildType(bool instantiateToBoundsAllowed, int numTypeArguments, | 1243 DartType buildType(bool instantiateToBoundsAllowed, int numTypeArguments, |
| 1244 DartType getTypeArgument(int i), List<int> implicitFunctionTypeIndices) { | 1244 DartType getTypeArgument(int i), List<int> implicitFunctionTypeIndices) { |
| 1245 DartType result = | 1245 DartType result = |
| 1246 (numTypeParameters == 0 && implicitFunctionTypeIndices.isEmpty) | 1246 (numTypeParameters == 0 && implicitFunctionTypeIndices.isEmpty) |
| 1247 ? type | 1247 ? type |
| 1248 : _buildType(instantiateToBoundsAllowed, numTypeArguments, | 1248 : _buildType(instantiateToBoundsAllowed, numTypeArguments, |
| 1249 getTypeArgument, implicitFunctionTypeIndices); | 1249 getTypeArgument, implicitFunctionTypeIndices); |
| 1250 if (result == null) { | 1250 if (result == null) { |
| 1251 // TODO(paulberry): figure out how to handle this case (which should | 1251 return DynamicTypeImpl.instance; |
| 1252 // only occur in the event of erroneous code). | |
| 1253 throw new UnimplementedError(); | |
| 1254 } | 1252 } |
| 1255 return result; | 1253 return result; |
| 1256 } | 1254 } |
| 1257 | 1255 |
| 1258 /** | 1256 /** |
| 1259 * If this reference refers to a type, build a [DartType]. Otherwise return | 1257 * If this reference refers to a type, build a [DartType]. Otherwise return |
| 1260 * `null`. If [numTypeArguments] is the same as the [numTypeParameters], | 1258 * `null`. If [numTypeArguments] is the same as the [numTypeParameters], |
| 1261 * the type is instantiated with type arguments returned by [getTypeArgument], | 1259 * the type is instantiated with type arguments returned by [getTypeArgument], |
| 1262 * otherwise it is instantiated with type parameter bounds (if strong mode), | 1260 * otherwise it is instantiated with type parameter bounds (if strong mode), |
| 1263 * or with `dynamic` type arguments. | 1261 * or with `dynamic` type arguments. |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1889 static String _getElementIdentifier(String name, ReferenceKind kind) { | 1887 static String _getElementIdentifier(String name, ReferenceKind kind) { |
| 1890 if (kind == ReferenceKind.topLevelPropertyAccessor || | 1888 if (kind == ReferenceKind.topLevelPropertyAccessor || |
| 1891 kind == ReferenceKind.propertyAccessor) { | 1889 kind == ReferenceKind.propertyAccessor) { |
| 1892 if (!name.endsWith('=')) { | 1890 if (!name.endsWith('=')) { |
| 1893 return name + '?'; | 1891 return name + '?'; |
| 1894 } | 1892 } |
| 1895 } | 1893 } |
| 1896 return name; | 1894 return name; |
| 1897 } | 1895 } |
| 1898 } | 1896 } |
| OLD | NEW |