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

Unified Diff: pkg/analyzer/test/src/task/strong/front_end_inference_test.dart

Issue 2920223008: Record method invocation targets that are not procedures. (Closed)
Patch Set: Created 3 years, 6 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
Index: pkg/analyzer/test/src/task/strong/front_end_inference_test.dart
diff --git a/pkg/analyzer/test/src/task/strong/front_end_inference_test.dart b/pkg/analyzer/test/src/task/strong/front_end_inference_test.dart
index a8d2788fffebf53c13b6104cfeebfb01202b047f..216d1712d9d8d9c6e39238dde1a767cea86f6e4e 100644
--- a/pkg/analyzer/test/src/task/strong/front_end_inference_test.dart
+++ b/pkg/analyzer/test/src/task/strong/front_end_inference_test.dart
@@ -411,7 +411,8 @@ class _InstrumentationVisitor extends RecursiveAstVisitor<Null> {
visitMethodInvocation(MethodInvocation node) {
super.visitMethodInvocation(node);
- if (node.target != null) {
+ var element = node.methodName.staticElement;
+ if (_elementRequiresMethodDispatch(element)) {
_recordTarget(node.methodName.offset, node.methodName.staticElement);
}
if (node.typeArguments == null) {
@@ -487,6 +488,17 @@ class _InstrumentationVisitor extends RecursiveAstVisitor<Null> {
}
}
+ bool _elementRequiresMethodDispatch(Element element) {
+ if (element is ClassMemberElement) {
+ return !element.isStatic;
+ } else if (element is ExecutableElement &&
+ element.enclosingElement is ClassElement) {
+ return !element.isStatic;
+ } else {
+ return false;
+ }
+ }
+
/// Based on DDC code generator's `_emitFunctionTypeArguments`
Iterable<DartType> _getInferredFunctionTypeArguments(
DartType g, DartType f, TypeArgumentList typeArgs) {

Powered by Google App Engine
This is Rietveld 408576698