Chromium Code Reviews| 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 8b1d4aef642245b9561218836732a219711629e0..f9ed726d25aed1b3fc5ff8ff3171fb590ae10447 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); |
|
scheglov
2016/04/26 15:54:19
I'm concerned that we perform method lookup multip
srawlins
2016/04/26 18:55:59
Maybe... element_resolver.dart is where INVOCATION
scheglov
2016/04/27 16:12:19
Yes, that's where I thought we could put the check
srawlins
2016/04/27 19:53:49
Acknowledged.
|
| + _checkForDeprecatedMemberUse(methodElement, node); |
| + } |
| return super.visitMethodInvocation(node); |
| } |
| @@ -539,6 +551,10 @@ class BestPracticesVerifier extends RecursiveAstVisitor<Object> { |
| if (!constructorElement.displayName.isEmpty) { |
| displayName = "$displayName.${constructorElement.displayName}"; |
| } |
| + } else if (element.displayName == FunctionElement.CALL_METHOD_NAME && |
|
Brian Wilkerson
2016/04/26 15:25:28
"element.displayName" --> "displayName"
srawlins
2016/04/27 19:53:49
Done.
|
| + node is MethodInvocation && |
| + node.staticInvokeType is InterfaceType) { |
| + displayName = "${node.staticInvokeType.displayName}.${element.displayName}"; |
| } |
| _errorReporter.reportErrorForNode( |
| HintCode.DEPRECATED_MEMBER_USE, node, [displayName]); |
| @@ -4250,7 +4266,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 |