Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(435)

Unified Diff: pkg/analyzer/lib/src/generated/resolver.dart

Issue 1922563003: @deprecated should work on 'called' objects (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Addressing feedback Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/task/dart.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/task/dart.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698