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

Side by Side Diff: pkg/analyzer/lib/src/summary/resynthesize.dart

Issue 2769703002: Revert "Issue 28580. Relax instantiate to bounds." (Closed)
Patch Set: Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « pkg/analyzer/lib/src/generated/resolver.dart ('k') | pkg/analyzer/lib/src/task/dart.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after
1287 // If type arguments are specified, use them. 1287 // If type arguments are specified, use them.
1288 // Otherwise, delay until they are requested. 1288 // Otherwise, delay until they are requested.
1289 if (numTypeParameters == 0) { 1289 if (numTypeParameters == 0) {
1290 return element.type; 1290 return element.type;
1291 } else if (numTypeArguments == numTypeParameters) { 1291 } else if (numTypeArguments == numTypeParameters) {
1292 typeArguments = _buildTypeArguments(numTypeArguments, getTypeArgument); 1292 typeArguments = _buildTypeArguments(numTypeArguments, getTypeArgument);
1293 } 1293 }
1294 InterfaceTypeImpl type = 1294 InterfaceTypeImpl type =
1295 new InterfaceTypeImpl.elementWithNameAndArgs(element, name, () { 1295 new InterfaceTypeImpl.elementWithNameAndArgs(element, name, () {
1296 if (typeArguments == null) { 1296 if (typeArguments == null) {
1297 if (libraryResynthesizer.summaryResynthesizer.strongMode) { 1297 if (libraryResynthesizer.summaryResynthesizer.strongMode &&
1298 instantiateToBoundsAllowed) {
1298 InterfaceType instantiatedToBounds = libraryResynthesizer 1299 InterfaceType instantiatedToBounds = libraryResynthesizer
1299 .summaryResynthesizer.context.typeSystem 1300 .summaryResynthesizer.context.typeSystem
1300 .instantiateToBounds(element.type) as InterfaceType; 1301 .instantiateToBounds(element.type) as InterfaceType;
1301 return instantiatedToBounds.typeArguments; 1302 return instantiatedToBounds.typeArguments;
1302 } else { 1303 } else {
1303 return new List<DartType>.filled( 1304 return new List<DartType>.filled(
1304 numTypeParameters, DynamicTypeImpl.instance); 1305 numTypeParameters, DynamicTypeImpl.instance);
1305 } 1306 }
1306 } 1307 }
1307 return typeArguments; 1308 return typeArguments;
1308 }); 1309 });
1309 // Mark the type as having implicit type arguments, so that we don't 1310 // Mark the type as having implicit type arguments, so that we don't
1310 // attempt to request them during constant expression resynthesizing. 1311 // attempt to request them during constant expression resynthesizing.
1311 if (typeArguments == null) { 1312 if (typeArguments == null) {
1312 libraryResynthesizer.typesWithImplicitTypeArguments.add(type); 1313 libraryResynthesizer.typesWithImplicitTypeArguments.add(type);
1313 } 1314 }
1314 // Done. 1315 // Done.
1315 return type; 1316 return type;
1316 } else if (element is FunctionTypedElement) { 1317 } else if (element is FunctionTypedElement) {
1317 if (element is FunctionTypeAliasElementHandle) { 1318 if (element is FunctionTypeAliasElementHandle) {
1318 List<DartType> typeArguments; 1319 List<DartType> typeArguments;
1319 if (numTypeArguments == numTypeParameters) { 1320 if (numTypeArguments == numTypeParameters) {
1320 typeArguments = 1321 typeArguments =
1321 _buildTypeArguments(numTypeArguments, getTypeArgument); 1322 _buildTypeArguments(numTypeArguments, getTypeArgument);
1322 } else if (libraryResynthesizer.summaryResynthesizer.strongMode) { 1323 } else if (libraryResynthesizer.summaryResynthesizer.strongMode &&
1324 instantiateToBoundsAllowed) {
1323 FunctionType instantiatedToBounds = libraryResynthesizer 1325 FunctionType instantiatedToBounds = libraryResynthesizer
1324 .summaryResynthesizer.context.typeSystem 1326 .summaryResynthesizer.context.typeSystem
1325 .instantiateToBounds(element.type) as FunctionType; 1327 .instantiateToBounds(element.type) as FunctionType;
1326 typeArguments = instantiatedToBounds.typeArguments; 1328 typeArguments = instantiatedToBounds.typeArguments;
1327 } else { 1329 } else {
1328 typeArguments = new List<DartType>.filled( 1330 typeArguments = new List<DartType>.filled(
1329 numTypeParameters, DynamicTypeImpl.instance); 1331 numTypeParameters, DynamicTypeImpl.instance);
1330 } 1332 }
1331 return new FunctionTypeImpl.elementWithNameAndArgs( 1333 return new FunctionTypeImpl.elementWithNameAndArgs(
1332 element, name, typeArguments, numTypeParameters != 0); 1334 element, name, typeArguments, numTypeParameters != 0);
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
1955 static String _getElementIdentifier(String name, ReferenceKind kind) { 1957 static String _getElementIdentifier(String name, ReferenceKind kind) {
1956 if (kind == ReferenceKind.topLevelPropertyAccessor || 1958 if (kind == ReferenceKind.topLevelPropertyAccessor ||
1957 kind == ReferenceKind.propertyAccessor) { 1959 kind == ReferenceKind.propertyAccessor) {
1958 if (!name.endsWith('=')) { 1960 if (!name.endsWith('=')) {
1959 return name + '?'; 1961 return name + '?';
1960 } 1962 }
1961 } 1963 }
1962 return name; 1964 return name;
1963 } 1965 }
1964 } 1966 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/resolver.dart ('k') | pkg/analyzer/lib/src/task/dart.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698