| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 /** | 49 /** |
| 50 * The class containing the AST nodes being visited, or `null` if we are not i
n the scope of | 50 * The class containing the AST nodes being visited, or `null` if we are not i
n the scope of |
| 51 * a class. | 51 * a class. |
| 52 */ | 52 */ |
| 53 ClassElement _enclosingClass; | 53 ClassElement _enclosingClass; |
| 54 | 54 |
| 55 /** | 55 /** |
| 56 * A flag indicating whether a surrounding member (compilation unit or class) | 56 * A flag indicating whether a surrounding member (compilation unit or class) |
| 57 * is deprecated. | 57 * is deprecated. |
| 58 */ | 58 */ |
| 59 bool inDeprecatedMember = false; | 59 bool inDeprecatedMember; |
| 60 | 60 |
| 61 /** | 61 /** |
| 62 * The error reporter by which errors will be reported. | 62 * The error reporter by which errors will be reported. |
| 63 */ | 63 */ |
| 64 final ErrorReporter _errorReporter; | 64 final ErrorReporter _errorReporter; |
| 65 | 65 |
| 66 /** | 66 /** |
| 67 * The type Future<Null>, which is needed for determining whether it is safe | 67 * The type Future<Null>, which is needed for determining whether it is safe |
| 68 * to have a bare "return;" in an async method. | 68 * to have a bare "return;" in an async method. |
| 69 */ | 69 */ |
| (...skipping 11 matching lines...) Expand all Loading... |
| 81 | 81 |
| 82 /** | 82 /** |
| 83 * Create a new instance of the [BestPracticesVerifier]. | 83 * Create a new instance of the [BestPracticesVerifier]. |
| 84 * | 84 * |
| 85 * @param errorReporter the error reporter | 85 * @param errorReporter the error reporter |
| 86 */ | 86 */ |
| 87 BestPracticesVerifier( | 87 BestPracticesVerifier( |
| 88 this._errorReporter, TypeProvider typeProvider, this._currentLibrary, | 88 this._errorReporter, TypeProvider typeProvider, this._currentLibrary, |
| 89 {TypeSystem typeSystem}) | 89 {TypeSystem typeSystem}) |
| 90 : _futureNullType = typeProvider.futureNullType, | 90 : _futureNullType = typeProvider.futureNullType, |
| 91 _typeSystem = typeSystem ?? new TypeSystemImpl(); | 91 _typeSystem = typeSystem ?? new TypeSystemImpl() { |
| 92 inDeprecatedMember = _currentLibrary.isDeprecated; |
| 93 } |
| 92 | 94 |
| 93 @override | 95 @override |
| 94 Object visitAnnotation(Annotation node) { | 96 Object visitAnnotation(Annotation node) { |
| 95 if (node.elementAnnotation?.isFactory == true) { | 97 if (node.elementAnnotation?.isFactory == true) { |
| 96 AstNode parent = node.parent; | 98 AstNode parent = node.parent; |
| 97 if (parent is MethodDeclaration) { | 99 if (parent is MethodDeclaration) { |
| 98 _checkForInvalidFactory(parent); | 100 _checkForInvalidFactory(parent); |
| 99 } else { | 101 } else { |
| 100 _errorReporter | 102 _errorReporter |
| 101 .reportErrorForNode(HintCode.INVALID_FACTORY_ANNOTATION, node, []); | 103 .reportErrorForNode(HintCode.INVALID_FACTORY_ANNOTATION, node, []); |
| (...skipping 11067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11169 return null; | 11171 return null; |
| 11170 } | 11172 } |
| 11171 if (identical(node.staticElement, variable)) { | 11173 if (identical(node.staticElement, variable)) { |
| 11172 if (node.inSetterContext()) { | 11174 if (node.inSetterContext()) { |
| 11173 result = true; | 11175 result = true; |
| 11174 } | 11176 } |
| 11175 } | 11177 } |
| 11176 return null; | 11178 return null; |
| 11177 } | 11179 } |
| 11178 } | 11180 } |
| OLD | NEW |