| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 engine.resolver.error_verifier; | 5 library engine.resolver.error_verifier; |
| 6 | 6 |
| 7 import "dart:math" as math; | 7 import "dart:math" as math; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import 'ast.dart'; | 10 import 'ast.dart'; |
| (...skipping 5760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5771 } | 5771 } |
| 5772 } | 5772 } |
| 5773 // done | 5773 // done |
| 5774 return hasProblem; | 5774 return hasProblem; |
| 5775 } | 5775 } |
| 5776 | 5776 |
| 5777 DartType _computeReturnTypeForMethod(Expression returnExpression) { | 5777 DartType _computeReturnTypeForMethod(Expression returnExpression) { |
| 5778 // TODO(paulberry): do the right thing for generators. | 5778 // TODO(paulberry): do the right thing for generators. |
| 5779 if (returnExpression == null) { | 5779 if (returnExpression == null) { |
| 5780 if (_enclosingFunction.isAsynchronous) { | 5780 if (_enclosingFunction.isAsynchronous) { |
| 5781 return _typeProvider.futureType.substitute4( | 5781 return _typeProvider.futureNullType; |
| 5782 <DartType>[_typeProvider.nullType]); | |
| 5783 } else { | 5782 } else { |
| 5784 return VoidTypeImpl.instance; | 5783 return VoidTypeImpl.instance; |
| 5785 } | 5784 } |
| 5786 } | 5785 } |
| 5787 DartType staticReturnType = getStaticType(returnExpression); | 5786 DartType staticReturnType = getStaticType(returnExpression); |
| 5788 if (staticReturnType != null && | 5787 if (staticReturnType != null && |
| 5789 _enclosingFunction.isAsynchronous && | 5788 _enclosingFunction.isAsynchronous && |
| 5790 staticReturnType.element != _typeProvider.futureType.element) { | 5789 staticReturnType.element != _typeProvider.futureType.element) { |
| 5791 return _typeProvider.futureType.substitute4(<DartType>[staticReturnType]); | 5790 return _typeProvider.futureType.substitute4(<DartType>[staticReturnType]); |
| 5792 } | 5791 } |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6229 toCheck.add(type.element); | 6228 toCheck.add(type.element); |
| 6230 // type arguments | 6229 // type arguments |
| 6231 if (type is InterfaceType) { | 6230 if (type is InterfaceType) { |
| 6232 InterfaceType interfaceType = type; | 6231 InterfaceType interfaceType = type; |
| 6233 for (DartType typeArgument in interfaceType.typeArguments) { | 6232 for (DartType typeArgument in interfaceType.typeArguments) { |
| 6234 _addTypeToCheck(typeArgument); | 6233 _addTypeToCheck(typeArgument); |
| 6235 } | 6234 } |
| 6236 } | 6235 } |
| 6237 } | 6236 } |
| 6238 } | 6237 } |
| OLD | NEW |