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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/inferrer/closure_tracer.dart

Issue 119123002: Fix a bug in the type inferrer, where a getter call was not seen as a potential closure call. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/language/inferrer_closure_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of type_graph_inferrer; 5 part of type_graph_inferrer;
6 6
7 class ClosureTracerVisitor extends TracerVisitor { 7 class ClosureTracerVisitor extends TracerVisitor {
8 ClosureTracerVisitor(tracedType, inferrer) : super(tracedType, inferrer); 8 ClosureTracerVisitor(tracedType, inferrer) : super(tracedType, inferrer);
9 9
10 void run() { 10 void run() {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 bailout('Passed to a closure'); 47 bailout('Passed to a closure');
48 } 48 }
49 } 49 }
50 50
51 visitStaticCallSiteTypeInformation(StaticCallSiteTypeInformation info) { 51 visitStaticCallSiteTypeInformation(StaticCallSiteTypeInformation info) {
52 super.visitStaticCallSiteTypeInformation(info); 52 super.visitStaticCallSiteTypeInformation(info);
53 Element called = info.calledElement; 53 Element called = info.calledElement;
54 if (called.isForeign(compiler) && called.name == 'JS') { 54 if (called.isForeign(compiler) && called.name == 'JS') {
55 bailout('Used in JS ${info.call}'); 55 bailout('Used in JS ${info.call}');
56 } 56 }
57 if (inferrer.types.getInferredTypeOf(called) == currentUser) {
58 // This node can be a closure call as well. For example, `foo()`
59 // where `foo` is a getter.
60 analyzeCall(info);
61 }
57 } 62 }
58 63
59 bool checkIfCurrentUser(element) { 64 bool checkIfCurrentUser(element) {
60 return inferrer.types.getInferredTypeOf(element) == currentUser; 65 return inferrer.types.getInferredTypeOf(element) == currentUser;
61 } 66 }
62 67
63 visitDynamicCallSiteTypeInformation(DynamicCallSiteTypeInformation info) { 68 visitDynamicCallSiteTypeInformation(DynamicCallSiteTypeInformation info) {
64 super.visitDynamicCallSiteTypeInformation(info); 69 super.visitDynamicCallSiteTypeInformation(info);
65 if (info.selector.isCall()) { 70 if (info.selector.isCall()) {
66 if (info.arguments.contains(currentUser) 71 if (info.arguments.contains(currentUser)
67 && !info.targets.every((element) => element.isFunction())) { 72 && !info.targets.every((element) => element.isFunction())) {
68 bailout('Passed to a closure'); 73 bailout('Passed to a closure');
69 } else if (info.targets.any((element) => checkIfCurrentUser(element))) { 74 } else if (info.targets.any((element) => checkIfCurrentUser(element))) {
70 analyzeCall(info); 75 analyzeCall(info);
71 } 76 }
72 } 77 }
73 } 78 }
74 } 79 }
OLDNEW
« no previous file with comments | « no previous file | tests/language/inferrer_closure_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698