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.resolver; | 5 library analyzer.src.generated.resolver; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 | 8 |
9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
10 import 'package:analyzer/dart/ast/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 return super.visitExportDirective(node); | 160 return super.visitExportDirective(node); |
161 } | 161 } |
162 | 162 |
163 @override | 163 @override |
164 Object visitForStatement(ForStatement node) { | 164 Object visitForStatement(ForStatement node) { |
165 _checkForPossibleNullCondition(node.condition); | 165 _checkForPossibleNullCondition(node.condition); |
166 return super.visitForStatement(node); | 166 return super.visitForStatement(node); |
167 } | 167 } |
168 | 168 |
169 @override | 169 @override |
| 170 Object visitConstructorDeclaration(ConstructorDeclaration node) { |
| 171 if (node.element.isFactory) { |
| 172 if (node.body is BlockFunctionBody) { |
| 173 // Check the block for a return statement, if not, create the hint. |
| 174 if (!ExitDetector.exits(node.body)) { |
| 175 _errorReporter.reportErrorForNode( |
| 176 HintCode.MISSING_RETURN, node, [node.returnType.name]); |
| 177 } |
| 178 } |
| 179 } |
| 180 return super.visitFunctionDeclaration(node); |
| 181 } |
| 182 |
| 183 @override |
170 Object visitFunctionDeclaration(FunctionDeclaration node) { | 184 Object visitFunctionDeclaration(FunctionDeclaration node) { |
171 bool wasInDeprecatedMember = inDeprecatedMember; | 185 bool wasInDeprecatedMember = inDeprecatedMember; |
172 ExecutableElement element = node.element; | 186 ExecutableElement element = node.element; |
173 if (element != null && element.isDeprecated) { | 187 if (element != null && element.isDeprecated) { |
174 inDeprecatedMember = true; | 188 inDeprecatedMember = true; |
175 } | 189 } |
176 try { | 190 try { |
177 _checkForMissingReturn(node.returnType, node.functionExpression.body); | 191 _checkForMissingReturn(node.returnType, node.functionExpression.body); |
178 return super.visitFunctionDeclaration(node); | 192 return super.visitFunctionDeclaration(node); |
179 } finally { | 193 } finally { |
(...skipping 10646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10826 return null; | 10840 return null; |
10827 } | 10841 } |
10828 if (identical(node.staticElement, variable)) { | 10842 if (identical(node.staticElement, variable)) { |
10829 if (node.inSetterContext()) { | 10843 if (node.inSetterContext()) { |
10830 result = true; | 10844 result = true; |
10831 } | 10845 } |
10832 } | 10846 } |
10833 return null; | 10847 return null; |
10834 } | 10848 } |
10835 } | 10849 } |
OLD | NEW |