| 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 'package:analyzer/src/generated/static_type_analyzer.dart'; |
| 11 |
| 10 import 'ast.dart'; | 12 import 'ast.dart'; |
| 11 import 'constant.dart'; | 13 import 'constant.dart'; |
| 12 import 'element.dart'; | 14 import 'element.dart'; |
| 13 import 'element_resolver.dart'; | 15 import 'element_resolver.dart'; |
| 14 import 'error.dart'; | 16 import 'error.dart'; |
| 15 import 'java_engine.dart'; | 17 import 'java_engine.dart'; |
| 16 import 'parser.dart' show Parser, ParserErrorCode; | 18 import 'parser.dart' show Parser, ParserErrorCode; |
| 17 import 'resolver.dart'; | 19 import 'resolver.dart'; |
| 18 import 'scanner.dart' as sc; | 20 import 'scanner.dart' as sc; |
| 19 import 'sdk.dart' show DartSdk, SdkLibrary; | 21 import 'sdk.dart' show DartSdk, SdkLibrary; |
| (...skipping 5858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5878 // never allowed to contain return statements with expressions. | 5880 // never allowed to contain return statements with expressions. |
| 5879 assert(!_inGenerator); | 5881 assert(!_inGenerator); |
| 5880 if (returnExpression == null) { | 5882 if (returnExpression == null) { |
| 5881 if (_enclosingFunction.isAsynchronous) { | 5883 if (_enclosingFunction.isAsynchronous) { |
| 5882 return _typeProvider.futureNullType; | 5884 return _typeProvider.futureNullType; |
| 5883 } else { | 5885 } else { |
| 5884 return VoidTypeImpl.instance; | 5886 return VoidTypeImpl.instance; |
| 5885 } | 5887 } |
| 5886 } | 5888 } |
| 5887 DartType staticReturnType = getStaticType(returnExpression); | 5889 DartType staticReturnType = getStaticType(returnExpression); |
| 5888 if (staticReturnType != null && | 5890 if (staticReturnType != null && _enclosingFunction.isAsynchronous) { |
| 5889 _enclosingFunction.isAsynchronous && | 5891 return _typeProvider.futureType.substitute4( |
| 5890 staticReturnType.element != _typeProvider.futureType.element) { | 5892 <DartType>[StaticTypeAnalyzer.flattenFutures(_typeProvider, staticRetu
rnType)]); |
| 5891 return _typeProvider.futureType.substitute4(<DartType>[staticReturnType]); | |
| 5892 } | 5893 } |
| 5893 return staticReturnType; | 5894 return staticReturnType; |
| 5894 } | 5895 } |
| 5895 | 5896 |
| 5896 /** | 5897 /** |
| 5897 * Return the error code that should be used when the given class references i
tself directly. | 5898 * Return the error code that should be used when the given class references i
tself directly. |
| 5898 * | 5899 * |
| 5899 * @param classElt the class that references itself | 5900 * @param classElt the class that references itself |
| 5900 * @return the error code that should be used | 5901 * @return the error code that should be used |
| 5901 */ | 5902 */ |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6329 toCheck.add(type.element); | 6330 toCheck.add(type.element); |
| 6330 // type arguments | 6331 // type arguments |
| 6331 if (type is InterfaceType) { | 6332 if (type is InterfaceType) { |
| 6332 InterfaceType interfaceType = type; | 6333 InterfaceType interfaceType = type; |
| 6333 for (DartType typeArgument in interfaceType.typeArguments) { | 6334 for (DartType typeArgument in interfaceType.typeArguments) { |
| 6334 _addTypeToCheck(typeArgument); | 6335 _addTypeToCheck(typeArgument); |
| 6335 } | 6336 } |
| 6336 } | 6337 } |
| 6337 } | 6338 } |
| 6338 } | 6339 } |
| OLD | NEW |