| 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; | 5 library engine.resolver; |
| 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/utilities_collection.dart'; | 10 import 'package:analyzer/src/generated/utilities_collection.dart'; |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 */ | 575 */ |
| 576 bool _checkForMissingReturn(TypeName returnType, FunctionBody body) { | 576 bool _checkForMissingReturn(TypeName returnType, FunctionBody body) { |
| 577 // Check that the method or function has a return type, and a function body | 577 // Check that the method or function has a return type, and a function body |
| 578 if (returnType == null || body == null) { | 578 if (returnType == null || body == null) { |
| 579 return false; | 579 return false; |
| 580 } | 580 } |
| 581 // Check that the body is a BlockFunctionBody | 581 // Check that the body is a BlockFunctionBody |
| 582 if (body is! BlockFunctionBody) { | 582 if (body is! BlockFunctionBody) { |
| 583 return false; | 583 return false; |
| 584 } | 584 } |
| 585 // Generators are never required to have a return statement. |
| 586 if (body.isGenerator) { |
| 587 return false; |
| 588 } |
| 585 // Check that the type is resolvable, and is not "void" | 589 // Check that the type is resolvable, and is not "void" |
| 586 DartType returnTypeType = returnType.type; | 590 DartType returnTypeType = returnType.type; |
| 587 if (returnTypeType == null || returnTypeType.isVoid) { | 591 if (returnTypeType == null || returnTypeType.isVoid) { |
| 588 return false; | 592 return false; |
| 589 } | 593 } |
| 590 // For async, give no hint if Future<Null> is assignable to the return | 594 // For async, give no hint if Future<Null> is assignable to the return |
| 591 // type. | 595 // type. |
| 592 if (body.isAsynchronous && _futureNullType.isAssignableTo(returnTypeType)) { | 596 if (body.isAsynchronous && _futureNullType.isAssignableTo(returnTypeType)) { |
| 593 return false; | 597 return false; |
| 594 } | 598 } |
| (...skipping 15002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15597 * library. | 15601 * library. |
| 15598 */ | 15602 */ |
| 15599 final HashSet<String> members = new HashSet<String>(); | 15603 final HashSet<String> members = new HashSet<String>(); |
| 15600 | 15604 |
| 15601 /** | 15605 /** |
| 15602 * Names of resolved or unresolved class members that are read in the | 15606 * Names of resolved or unresolved class members that are read in the |
| 15603 * library. | 15607 * library. |
| 15604 */ | 15608 */ |
| 15605 final HashSet<String> readMembers = new HashSet<String>(); | 15609 final HashSet<String> readMembers = new HashSet<String>(); |
| 15606 } | 15610 } |
| OLD | NEW |