Chromium Code Reviews| 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 2310d8dc3721c9ac9441a08d55411c800002f562..6dc463ae1dc6b53d817f15e23a36736a94bcae4b 100644 |
| --- a/pkg/compiler/lib/src/inferrer/node_tracer.dart |
| +++ b/pkg/compiler/lib/src/inferrer/node_tracer.dart |
| @@ -210,8 +210,15 @@ abstract class TracerVisitor implements TypeInformationVisitor { |
| visitStaticCallSiteTypeInformation(StaticCallSiteTypeInformation info) { |
| Element called = info.calledElement; |
| - if (inferrer.types.getInferredTypeOf(called) == currentUser) { |
| - addNewEscapeInformation(info); |
| + if (called.isLocal) { |
| + if (inferrer.types.getInferredTypeOfLocalFunction(called) == |
| + currentUser) { |
| + addNewEscapeInformation(info); |
| + } |
| + } else { |
| + if (inferrer.types.getInferredTypeOfMember(called) == currentUser) { |
| + addNewEscapeInformation(info); |
| + } |
| } |
|
Siggi Cherem (dart-lang)
2017/06/28 16:30:24
nit: maybe use this style to avoid duplicating the
Johnni Winther
2017/06/29 12:36:48
Done.
|
| } |
| @@ -297,7 +304,7 @@ abstract class TracerVisitor implements TypeInformationVisitor { |
| return isIndexSetArgument(info, 1); |
| } |
| - void bailoutIfReaches(bool predicate(Element e)) { |
| + void bailoutIfReaches(bool predicate(ParameterElement e)) { |
| for (var user in currentUser.users) { |
| if (user is ParameterTypeInformation) { |
| if (predicate(user.element)) { |
| @@ -393,8 +400,7 @@ abstract class TracerVisitor implements TypeInformationVisitor { |
| Iterable<TypeInformation> inferredTargetTypes = |
| info.targets.map((MemberEntity entity) { |
| - MemberElement element = entity; |
| - return inferrer.types.getInferredTypeOf(element); |
| + return inferrer.types.getInferredTypeOfMember(entity); |
| }); |
| if (inferredTargetTypes.any((user) => user == currentUser)) { |
| addNewEscapeInformation(info); |
| @@ -406,7 +412,7 @@ abstract class TracerVisitor implements TypeInformationVisitor { |
| * The definition of what a list adding method is has to stay in sync with |
| * [mightAddToContainer]. |
| */ |
| - bool isParameterOfListAddingMethod(Element element) { |
| + bool isParameterOfListAddingMethod(ParameterElement element) { |
| if (!element.isRegularParameter) return false; |
| if (element.enclosingClass != |
| inferrer.closedWorld.commonElements.jsArrayClass) { |
| @@ -421,7 +427,7 @@ abstract class TracerVisitor implements TypeInformationVisitor { |
| * The definition of what a list adding method is has to stay in sync with |
| * [isIndexSetKey] and [isIndexSetValue]. |
| */ |
| - bool isParameterOfMapAddingMethod(Element element) { |
| + bool isParameterOfMapAddingMethod(ParameterElement element) { |
| if (!element.isRegularParameter) return false; |
| if (element.enclosingClass != |
| inferrer.closedWorld.commonElements.mapLiteralClass) { |
| @@ -462,17 +468,16 @@ abstract class TracerVisitor implements TypeInformationVisitor { |
| } |
| void visitParameterTypeInformation(ParameterTypeInformation info) { |
| - ParameterElement element = info.element; |
| - if (inferrer.isNativeMember(element.functionDeclaration)) { |
| + if (inferrer.isNativeMember(info.declaration)) { |
| bailout('Passed to a native method'); |
| } |
| if (!inferrer.compiler.backend |
| .canFunctionParametersBeUsedForGlobalOptimizations( |
| - element.functionDeclaration, inferrer.closedWorld)) { |
| + info.declaration, inferrer.closedWorld)) { |
| bailout('Escape to code that has special backend treatment'); |
| } |
| - if (isParameterOfListAddingMethod(element) || |
| - isParameterOfMapAddingMethod(element)) { |
| + if (isParameterOfListAddingMethod(info.element) || |
| + isParameterOfMapAddingMethod(info.element)) { |
| // These elements are being handled in |
| // [visitDynamicCallSiteTypeInformation]. |
| return; |