Chromium Code Reviews| 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 2288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2299 } | 2299 } |
| 2300 if (expectedReturnType is InterfaceType && | 2300 if (expectedReturnType is InterfaceType && |
| 2301 expectedReturnType.isDartAsyncFuture) { | 2301 expectedReturnType.isDartAsyncFuture) { |
| 2302 DartType futureArgument = expectedReturnType.typeArguments[0]; | 2302 DartType futureArgument = expectedReturnType.typeArguments[0]; |
| 2303 if (futureArgument.isDynamic || | 2303 if (futureArgument.isDynamic || |
| 2304 futureArgument.isDartCoreNull || | 2304 futureArgument.isDartCoreNull || |
| 2305 futureArgument.isObject) { | 2305 futureArgument.isObject) { |
| 2306 return; | 2306 return; |
| 2307 } | 2307 } |
| 2308 } | 2308 } |
| 2309 } else if (expectedReturnType.isDynamic || expectedReturnType.isVoid) { | 2309 } else if (expectedReturnType.isDynamic || |
| 2310 expectedReturnType.isVoid || | |
| 2311 _typeSystem.isSubtypeOf( | |
| 2312 expectedReturnType, _typeProvider.futureOrNullType)) { | |
|
Jennifer Messerly
2017/02/03 18:47:53
If I have:
Future<Null> foo() {
return;
Leaf
2017/02/06 18:27:15
Good catch, thanks! Fixed to keep it simple for n
| |
| 2310 return; | 2313 return; |
| 2311 } | 2314 } |
| 2312 _hasReturnWithoutValue = true; | 2315 _hasReturnWithoutValue = true; |
| 2313 _errorReporter.reportErrorForNode( | 2316 _errorReporter.reportErrorForNode( |
| 2314 StaticWarningCode.RETURN_WITHOUT_VALUE, statement); | 2317 StaticWarningCode.RETURN_WITHOUT_VALUE, statement); |
| 2315 return; | 2318 return; |
| 2316 } else if (_inGenerator) { | 2319 } else if (_inGenerator) { |
| 2317 // RETURN_IN_GENERATOR | 2320 // RETURN_IN_GENERATOR |
| 2318 _errorReporter.reportErrorForNode( | 2321 _errorReporter.reportErrorForNode( |
| 2319 CompileTimeErrorCode.RETURN_IN_GENERATOR, | 2322 CompileTimeErrorCode.RETURN_IN_GENERATOR, |
| (...skipping 4757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7077 class _InvocationCollector extends RecursiveAstVisitor { | 7080 class _InvocationCollector extends RecursiveAstVisitor { |
| 7078 final List<String> superCalls = <String>[]; | 7081 final List<String> superCalls = <String>[]; |
| 7079 | 7082 |
| 7080 @override | 7083 @override |
| 7081 visitMethodInvocation(MethodInvocation node) { | 7084 visitMethodInvocation(MethodInvocation node) { |
| 7082 if (node.target is SuperExpression) { | 7085 if (node.target is SuperExpression) { |
| 7083 superCalls.add(node.methodName.name); | 7086 superCalls.add(node.methodName.name); |
| 7084 } | 7087 } |
| 7085 } | 7088 } |
| 7086 } | 7089 } |
| OLD | NEW |