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

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

Issue 2665813002: Fix summary type inference for async closures. (Closed)
Patch Set: Created 3 years, 10 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 | « no previous file | pkg/analyzer/test/src/task/strong/inferred_type_test.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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 /** 5 /**
6 * This library is capable of producing linked summaries from unlinked 6 * This library is capable of producing linked summaries from unlinked
7 * ones (or prelinked ones). It functions by building a miniature 7 * ones (or prelinked ones). It functions by building a miniature
8 * element model to represent the contents of the summaries, and then 8 * element model to represent the contents of the summaries, and then
9 * scanning the element model to gather linked information and adding 9 * scanning the element model to gather linked information and adding
10 * it to the summary data structures. 10 * it to the summary data structures.
(...skipping 4654 matching lines...) Expand 10 before | Expand all | Expand 10 after
4665 4665
4666 void evaluate(bool inCycle) { 4666 void evaluate(bool inCycle) {
4667 if (inCycle) { 4667 if (inCycle) {
4668 functionElement._setInferredType(DynamicTypeImpl.instance); 4668 functionElement._setInferredType(DynamicTypeImpl.instance);
4669 } else { 4669 } else {
4670 var bodyType = new ExprTypeComputer(functionElement).compute(); 4670 var bodyType = new ExprTypeComputer(functionElement).compute();
4671 if (functionElement.isAsynchronous) { 4671 if (functionElement.isAsynchronous) {
4672 var linker = functionElement.compilationUnit.library._linker; 4672 var linker = functionElement.compilationUnit.library._linker;
4673 var typeProvider = linker.typeProvider; 4673 var typeProvider = linker.typeProvider;
4674 var typeSystem = linker.typeSystem; 4674 var typeSystem = linker.typeSystem;
4675 if (bodyType.isDartAsyncFutureOr) {
4676 bodyType = (bodyType as InterfaceType).typeArguments[0];
4677 }
4675 bodyType = typeProvider.futureType 4678 bodyType = typeProvider.futureType
4676 .instantiate([bodyType.flattenFutures(typeSystem)]); 4679 .instantiate([bodyType.flattenFutures(typeSystem)]);
4677 } 4680 }
4678 functionElement._setInferredType(bodyType); 4681 functionElement._setInferredType(bodyType);
4679 } 4682 }
4680 } 4683 }
4681 4684
4682 @override 4685 @override
4683 String toString() => 'TypeInferenceNode($functionElement)'; 4686 String toString() => 'TypeInferenceNode($functionElement)';
4684 } 4687 }
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
4995 * there are no type parameters in scope. 4998 * there are no type parameters in scope.
4996 */ 4999 */
4997 TypeParameterizedElementMixin get _typeParameterContext; 5000 TypeParameterizedElementMixin get _typeParameterContext;
4998 5001
4999 @override 5002 @override
5000 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); 5003 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
5001 5004
5002 @override 5005 @override
5003 String toString() => '$enclosingElement.$name'; 5006 String toString() => '$enclosingElement.$name';
5004 } 5007 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/src/task/strong/inferred_type_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698