Index: pkg/compiler/lib/src/inferrer/node_tracer.dart |
diff --git a/pkg/compiler/lib/src/inferrer/node_tracer.dart b/pkg/compiler/lib/src/inferrer/node_tracer.dart |
index ed1a0073c1c5317bc3aa21ca678dc2d17a66068b..0bfbea7443f112acf647506f82928d8ffccc4f56 100644 |
--- a/pkg/compiler/lib/src/inferrer/node_tracer.dart |
+++ b/pkg/compiler/lib/src/inferrer/node_tracer.dart |
@@ -431,7 +431,7 @@ abstract class TracerVisitor implements TypeInformationVisitor { |
return (name == '[]='); |
} |
- bool isClosure(Element element) { |
+ bool isClosure(MemberEntity element) { |
if (!element.isFunction) return false; |
/// Creating an instance of a class that implements [Function] also |
@@ -442,8 +442,8 @@ abstract class TracerVisitor implements TypeInformationVisitor { |
if (element.isInstanceMember && element.name == Identifiers.call) { |
return true; |
} |
- Element outermost = element.outermostEnclosingMemberOrTopLevel; |
- return outermost.declaration != element.declaration; |
+ ClassEntity cls = element.enclosingClass; |
+ return cls != null && cls.isClosure; |
} |
void visitMemberTypeInformation(MemberTypeInformation info) { |