| Index: pkg/compiler/lib/src/inferrer/closure_tracer.dart
|
| diff --git a/pkg/compiler/lib/src/inferrer/closure_tracer.dart b/pkg/compiler/lib/src/inferrer/closure_tracer.dart
|
| index 3901f8c46976f064e4876509c1f6b833d389fc9d..b758ecea3ab57be99929274afcd58a829225059c 100644
|
| --- a/pkg/compiler/lib/src/inferrer/closure_tracer.dart
|
| +++ b/pkg/compiler/lib/src/inferrer/closure_tracer.dart
|
| @@ -6,6 +6,7 @@ library compiler.src.inferrer.closure_tracer;
|
|
|
| import '../common/names.dart' show Names;
|
| import '../elements/elements.dart';
|
| +import '../elements/entities.dart';
|
| import '../js_backend/backend.dart' show JavaScriptBackend;
|
| import '../types/types.dart' show TypeMask;
|
| import '../universe/selector.dart' show Selector;
|
| @@ -15,7 +16,7 @@ import 'node_tracer.dart';
|
| import 'type_graph_nodes.dart';
|
|
|
| class ClosureTracerVisitor extends TracerVisitor {
|
| - final Iterable<MethodElement> tracedElements;
|
| + final Iterable<FunctionEntity> tracedElements;
|
| final List<CallSiteTypeInformation> _callsToAnalyze =
|
| new List<CallSiteTypeInformation>();
|
|
|
| @@ -29,8 +30,9 @@ class ClosureTracerVisitor extends TracerVisitor {
|
| analyze();
|
| if (!continueAnalyzing) return;
|
| _callsToAnalyze.forEach(_analyzeCall);
|
| - for (MethodElement e in tracedElements) {
|
| - e.functionSignature.forEachParameter((Element parameter) {
|
| + for (MethodElement element in tracedElements) {
|
| + MethodElement implementation = element.implementation;
|
| + implementation.functionSignature.forEachParameter((Element parameter) {
|
| ElementTypeInformation info =
|
| inferrer.types.getInferredTypeOfParameter(parameter);
|
| info.disableInferenceForClosures = false;
|
| @@ -52,7 +54,7 @@ class ClosureTracerVisitor extends TracerVisitor {
|
| void _analyzeCall(CallSiteTypeInformation info) {
|
| Selector selector = info.selector;
|
| TypeMask mask = info.mask;
|
| - tracedElements.forEach((MethodElement functionElement) {
|
| + tracedElements.forEach((FunctionEntity functionElement) {
|
| if (!selector.callStructure
|
| .signatureApplies(functionElement.parameterStructure)) {
|
| return;
|
| @@ -76,9 +78,8 @@ class ClosureTracerVisitor extends TracerVisitor {
|
| @override
|
| visitStaticCallSiteTypeInformation(StaticCallSiteTypeInformation info) {
|
| super.visitStaticCallSiteTypeInformation(info);
|
| - Element called = info.calledElement;
|
| - if (compiler.backend
|
| - .isForeign(inferrer.closedWorld.commonElements, called)) {
|
| + MemberEntity called = info.calledElement;
|
| + if (inferrer.closedWorld.commonElements.isForeign(called)) {
|
| String name = called.name;
|
| if (name == JavaScriptBackend.JS || name == 'DART_CLOSURE_TO_JS') {
|
| bailout('Used in JS ${info.call}');
|
| @@ -92,18 +93,17 @@ class ClosureTracerVisitor extends TracerVisitor {
|
| // where `foo` is a getter.
|
| _registerCallForLaterAnalysis(info);
|
| }
|
| - if (called is MemberElement &&
|
| - _checkIfFunctionApply(called) &&
|
| + if (_checkIfFunctionApply(called) &&
|
| info.arguments != null &&
|
| info.arguments.contains(currentUser)) {
|
| _tagAsFunctionApplyTarget("static call");
|
| }
|
| }
|
|
|
| - bool _checkIfCurrentUser(MemberElement element) =>
|
| + bool _checkIfCurrentUser(MemberEntity element) =>
|
| inferrer.types.getInferredTypeOfMember(element) == currentUser;
|
|
|
| - bool _checkIfFunctionApply(MemberElement element) {
|
| + bool _checkIfFunctionApply(MemberEntity element) {
|
| return inferrer.closedWorld.commonElements.isFunctionApplyMethod(element);
|
| }
|
|
|
|
|