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

Side by Side Diff: pkg/compiler/lib/src/universe/use.dart

Issue 2992863002: Support forEachClassMember on closure classes (Closed)
Patch Set: Updated cf. comments Created 3 years, 4 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 /// This library defines individual world impacts. 5 /// This library defines individual world impacts.
6 /// 6 ///
7 /// We call these building blocks `uses`. Each `use` is a single impact of the 7 /// We call these building blocks `uses`. Each `use` is a single impact of the
8 /// world. Some example uses are: 8 /// world. Some example uses are:
9 /// 9 ///
10 /// * an invocation of a top level function 10 /// * an invocation of a top level function
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 } 70 }
71 71
72 enum StaticUseKind { 72 enum StaticUseKind {
73 GENERAL, 73 GENERAL,
74 STATIC_TEAR_OFF, 74 STATIC_TEAR_OFF,
75 SUPER_TEAR_OFF, 75 SUPER_TEAR_OFF,
76 SUPER_FIELD_SET, 76 SUPER_FIELD_SET,
77 FIELD_GET, 77 FIELD_GET,
78 FIELD_SET, 78 FIELD_SET,
79 CLOSURE, 79 CLOSURE,
80 CALL_METHOD,
80 CONSTRUCTOR_INVOKE, 81 CONSTRUCTOR_INVOKE,
81 CONST_CONSTRUCTOR_INVOKE, 82 CONST_CONSTRUCTOR_INVOKE,
82 REDIRECTION, 83 REDIRECTION,
83 DIRECT_INVOKE, 84 DIRECT_INVOKE,
84 DIRECT_USE, 85 DIRECT_USE,
85 INLINING, 86 INLINING,
86 } 87 }
87 88
88 /// Statically known use of an [Element]. 89 /// Statically known use of an [Element].
89 // TODO(johnniwinther): Create backend-specific implementations with better 90 // TODO(johnniwinther): Create backend-specific implementations with better
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 failedAt(element, 371 failedAt(element,
371 "Field init element $element must be an instance or boxed field.")); 372 "Field init element $element must be an instance or boxed field."));
372 return new StaticUse.internal(element, StaticUseKind.FIELD_SET); 373 return new StaticUse.internal(element, StaticUseKind.FIELD_SET);
373 } 374 }
374 375
375 /// Read of a local function [element]. 376 /// Read of a local function [element].
376 factory StaticUse.closure(Local element) { 377 factory StaticUse.closure(Local element) {
377 return new StaticUse.internal(element, StaticUseKind.CLOSURE); 378 return new StaticUse.internal(element, StaticUseKind.CLOSURE);
378 } 379 }
379 380
381 /// Read of a call [method] on a closureClass.
382 factory StaticUse.callMethod(FunctionEntity method) {
383 return new StaticUse.internal(method, StaticUseKind.CALL_METHOD);
384 }
385
380 /// Use of [element] through reflection. 386 /// Use of [element] through reflection.
381 factory StaticUse.mirrorUse(MemberEntity element) { 387 factory StaticUse.mirrorUse(MemberEntity element) {
382 return new StaticUse.internal(element, StaticUseKind.GENERAL); 388 return new StaticUse.internal(element, StaticUseKind.GENERAL);
383 } 389 }
384 390
385 /// Implicit method/constructor invocation of [element] created by the 391 /// Implicit method/constructor invocation of [element] created by the
386 /// backend. 392 /// backend.
387 factory StaticUse.implicitInvoke(FunctionEntity element) { 393 factory StaticUse.implicitInvoke(FunctionEntity element) {
388 return new StaticUse.internal(element, StaticUseKind.GENERAL); 394 return new StaticUse.internal(element, StaticUseKind.GENERAL);
389 } 395 }
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 : this._(value, ConstantUseKind.DIRECT); 526 : this._(value, ConstantUseKind.DIRECT);
521 527
522 bool operator ==(other) { 528 bool operator ==(other) {
523 if (identical(this, other)) return true; 529 if (identical(this, other)) return true;
524 if (other is! ConstantUse) return false; 530 if (other is! ConstantUse) return false;
525 return value == other.value; 531 return value == other.value;
526 } 532 }
527 533
528 String toString() => 'ConstantUse(${value.toStructuredText()},$kind)'; 534 String toString() => 'ConstantUse(${value.toStructuredText()},$kind)';
529 } 535 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698