Index: pkg/analyzer/lib/src/generated/resolver.dart |
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart |
index 3b06ea0bd1c5cc2e839f6606c9e42c27937f8ac9..dbb7be8ce9a3780c2df6c04599ab7f12782c6a51 100644 |
--- a/pkg/analyzer/lib/src/generated/resolver.dart |
+++ b/pkg/analyzer/lib/src/generated/resolver.dart |
@@ -77,11 +77,17 @@ class BestPracticesVerifier extends RecursiveAstVisitor<Object> { |
TypeSystem _typeSystem; |
/** |
+ * The current library |
+ */ |
+ LibraryElement _currentLibrary; |
+ |
+ /** |
* Create a new instance of the [BestPracticesVerifier]. |
* |
* @param errorReporter the error reporter |
*/ |
- BestPracticesVerifier(this._errorReporter, TypeProvider typeProvider, |
+ BestPracticesVerifier( |
+ this._errorReporter, TypeProvider typeProvider, this._currentLibrary, |
{TypeSystem typeSystem}) |
: _futureNullType = typeProvider.futureNullType, |
_typeSystem = (typeSystem != null) ? typeSystem : new TypeSystemImpl(); |
@@ -239,6 +245,12 @@ class BestPracticesVerifier extends RecursiveAstVisitor<Object> { |
Object visitMethodInvocation(MethodInvocation node) { |
_checkForCanBeNullAfterNullAware(node.realTarget, node.operator); |
_checkForInvalidProtectedMethodCalls(node); |
+ DartType staticInvokeType = node.staticInvokeType; |
+ if (staticInvokeType is InterfaceType) { |
+ MethodElement methodElement = staticInvokeType.lookUpMethod( |
+ FunctionElement.CALL_METHOD_NAME, _currentLibrary); |
+ _checkForDeprecatedMemberUse(methodElement, node); |
+ } |
return super.visitMethodInvocation(node); |
} |
@@ -540,6 +552,10 @@ class BestPracticesVerifier extends RecursiveAstVisitor<Object> { |
if (!element.displayName.isEmpty) { |
displayName = "$displayName.${element.displayName}"; |
} |
+ } else if (displayName == FunctionElement.CALL_METHOD_NAME && |
+ node is MethodInvocation && |
+ node.staticInvokeType is InterfaceType) { |
+ displayName = "${node.staticInvokeType.displayName}.${element.displayName}"; |
} |
_errorReporter.reportErrorForNode( |
HintCode.DEPRECATED_MEMBER_USE, node, [displayName]); |
@@ -4222,7 +4238,8 @@ class HintGenerator { |
unit.accept(new Dart2JSVerifier(errorReporter)); |
} |
// Dart best practices |
- unit.accept(new BestPracticesVerifier(errorReporter, _context.typeProvider, |
+ unit.accept(new BestPracticesVerifier( |
+ errorReporter, _context.typeProvider, _library, |
typeSystem: _context.typeSystem)); |
unit.accept(new OverrideVerifier(errorReporter, _manager)); |
// Find to-do comments |