| 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 analyzer.src.generated.error_verifier; | 5 library analyzer.src.generated.error_verifier; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import "dart:math" as math; | 8 import "dart:math" as math; |
| 9 | 9 |
| 10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
| (...skipping 2299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2310 expectedReturnType.isDartAsyncFuture) { | 2310 expectedReturnType.isDartAsyncFuture) { |
| 2311 DartType futureArgument = expectedReturnType.typeArguments[0]; | 2311 DartType futureArgument = expectedReturnType.typeArguments[0]; |
| 2312 if (futureArgument.isDynamic || | 2312 if (futureArgument.isDynamic || |
| 2313 futureArgument.isDartCoreNull || | 2313 futureArgument.isDartCoreNull || |
| 2314 futureArgument.isObject) { | 2314 futureArgument.isObject) { |
| 2315 return; | 2315 return; |
| 2316 } | 2316 } |
| 2317 } | 2317 } |
| 2318 } else if (expectedReturnType.isDynamic || | 2318 } else if (expectedReturnType.isDynamic || |
| 2319 expectedReturnType.isVoid || | 2319 expectedReturnType.isVoid || |
| 2320 expectedReturnType.isDartCoreNull) { | 2320 (expectedReturnType.isDartCoreNull && _options.strongMode)) { |
| 2321 // TODO(leafp): Empty returns shouldn't be allowed for Null in strong |
| 2322 // mode either once we allow void as a type argument. But for now, the |
| 2323 // only type we can validly infer for f.then((_) {print("hello");}) is |
| 2324 // Future<Null>, so we allow this. |
| 2321 return; | 2325 return; |
| 2322 } | 2326 } |
| 2323 _hasReturnWithoutValue = true; | 2327 _hasReturnWithoutValue = true; |
| 2324 _errorReporter.reportErrorForNode( | 2328 _errorReporter.reportErrorForNode( |
| 2325 StaticWarningCode.RETURN_WITHOUT_VALUE, statement); | 2329 StaticWarningCode.RETURN_WITHOUT_VALUE, statement); |
| 2326 return; | 2330 return; |
| 2327 } else if (_inGenerator) { | 2331 } else if (_inGenerator) { |
| 2328 // RETURN_IN_GENERATOR | 2332 // RETURN_IN_GENERATOR |
| 2329 _errorReporter.reportErrorForNode( | 2333 _errorReporter.reportErrorForNode( |
| 2330 CompileTimeErrorCode.RETURN_IN_GENERATOR, | 2334 CompileTimeErrorCode.RETURN_IN_GENERATOR, |
| (...skipping 4759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7090 class _InvocationCollector extends RecursiveAstVisitor { | 7094 class _InvocationCollector extends RecursiveAstVisitor { |
| 7091 final List<String> superCalls = <String>[]; | 7095 final List<String> superCalls = <String>[]; |
| 7092 | 7096 |
| 7093 @override | 7097 @override |
| 7094 visitMethodInvocation(MethodInvocation node) { | 7098 visitMethodInvocation(MethodInvocation node) { |
| 7095 if (node.target is SuperExpression) { | 7099 if (node.target is SuperExpression) { |
| 7096 superCalls.add(node.methodName.name); | 7100 superCalls.add(node.methodName.name); |
| 7097 } | 7101 } |
| 7098 } | 7102 } |
| 7099 } | 7103 } |
| OLD | NEW |