OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |