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

Side by Side Diff: pkg/compiler/lib/src/inferrer/node_tracer.dart

Issue 2970953003: Use entities in ParameterTypeInformation (Closed)
Patch Set: Fix Created 3 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | pkg/compiler/lib/src/inferrer/type_graph_nodes.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 library compiler.src.inferrer.node_tracer; 5 library compiler.src.inferrer.node_tracer;
6 6
7 import '../common/names.dart' show Identifiers; 7 import '../common/names.dart' show Identifiers;
8 import '../compiler.dart' show Compiler; 8 import '../compiler.dart' show Compiler;
9 import '../elements/elements.dart'; 9 import '../elements/elements.dart';
10 import '../elements/entities.dart'; 10 import '../elements/entities.dart';
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 bool isParameterOfMapAddingMethod(ParameterElement element) { 424 bool isParameterOfMapAddingMethod(ParameterElement element) {
425 if (!element.isRegularParameter) return false; 425 if (!element.isRegularParameter) return false;
426 if (element.enclosingClass != 426 if (element.enclosingClass !=
427 inferrer.closedWorld.commonElements.mapLiteralClass) { 427 inferrer.closedWorld.commonElements.mapLiteralClass) {
428 return false; 428 return false;
429 } 429 }
430 String name = element.enclosingElement.name; 430 String name = element.enclosingElement.name;
431 return (name == '[]='); 431 return (name == '[]=');
432 } 432 }
433 433
434 bool isClosure(Element element) { 434 bool isClosure(MemberEntity element) {
435 if (!element.isFunction) return false; 435 if (!element.isFunction) return false;
436 436
437 /// Creating an instance of a class that implements [Function] also 437 /// Creating an instance of a class that implements [Function] also
438 /// closurizes the corresponding [call] member. We do not currently 438 /// closurizes the corresponding [call] member. We do not currently
439 /// track these, thus the check for [isClosurized] on such a method will 439 /// track these, thus the check for [isClosurized] on such a method will
440 /// return false. Instead we catch that case here for now. 440 /// return false. Instead we catch that case here for now.
441 // TODO(herhut): Handle creation of closures from instances of Function. 441 // TODO(herhut): Handle creation of closures from instances of Function.
442 if (element.isInstanceMember && element.name == Identifiers.call) { 442 if (element.isInstanceMember && element.name == Identifiers.call) {
443 return true; 443 return true;
444 } 444 }
445 Element outermost = element.outermostEnclosingMemberOrTopLevel; 445 ClassEntity cls = element.enclosingClass;
446 return outermost.declaration != element.declaration; 446 return cls != null && cls.isClosure;
447 } 447 }
448 448
449 void visitMemberTypeInformation(MemberTypeInformation info) { 449 void visitMemberTypeInformation(MemberTypeInformation info) {
450 if (info.isClosurized) { 450 if (info.isClosurized) {
451 bailout('Returned from a closurized method'); 451 bailout('Returned from a closurized method');
452 } 452 }
453 if (isClosure(info.member)) { 453 if (isClosure(info.member)) {
454 bailout('Returned from a closure'); 454 bailout('Returned from a closure');
455 } 455 }
456 if (info.member.isField && 456 if (info.member.isField &&
(...skipping 15 matching lines...) Expand all
472 } 472 }
473 if (isParameterOfListAddingMethod(info.parameter) || 473 if (isParameterOfListAddingMethod(info.parameter) ||
474 isParameterOfMapAddingMethod(info.parameter)) { 474 isParameterOfMapAddingMethod(info.parameter)) {
475 // These elements are being handled in 475 // These elements are being handled in
476 // [visitDynamicCallSiteTypeInformation]. 476 // [visitDynamicCallSiteTypeInformation].
477 return; 477 return;
478 } 478 }
479 addNewEscapeInformation(info); 479 addNewEscapeInformation(info);
480 } 480 }
481 } 481 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/inferrer/type_graph_nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698