OLD | NEW |
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 20 matching lines...) Expand all Loading... |
31 /// The use of a dynamic property. [selector] defined the name and kind of the | 31 /// The use of a dynamic property. [selector] defined the name and kind of the |
32 /// property and [mask] defines the known constraint for the object on which | 32 /// property and [mask] defines the known constraint for the object on which |
33 /// the property is accessed. | 33 /// the property is accessed. |
34 class DynamicUse { | 34 class DynamicUse { |
35 final Selector selector; | 35 final Selector selector; |
36 final ReceiverConstraint mask; | 36 final ReceiverConstraint mask; |
37 | 37 |
38 DynamicUse(this.selector, this.mask); | 38 DynamicUse(this.selector, this.mask); |
39 | 39 |
40 bool appliesUnnamed(Element element, ClassWorld world) { | 40 bool appliesUnnamed(Element element, ClassWorld world) { |
41 return selector.appliesUnnamed(element, world) && | 41 return selector.appliesUnnamed(element, world.backend) && |
42 (mask == null || mask.canHit(element, selector, world)); | 42 (mask == null || mask.canHit(element, selector, world)); |
43 } | 43 } |
44 | 44 |
45 DynamicUseKind get kind { | 45 DynamicUseKind get kind { |
46 if (selector.isGetter) { | 46 if (selector.isGetter) { |
47 return DynamicUseKind.GET; | 47 return DynamicUseKind.GET; |
48 } else if (selector.isSetter) { | 48 } else if (selector.isSetter) { |
49 return DynamicUseKind.SET; | 49 return DynamicUseKind.SET; |
50 } else { | 50 } else { |
51 return DynamicUseKind.INVOKE; | 51 return DynamicUseKind.INVOKE; |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 } | 310 } |
311 | 311 |
312 bool operator ==(other) { | 312 bool operator ==(other) { |
313 if (identical(this, other)) return true; | 313 if (identical(this, other)) return true; |
314 if (other is! TypeUse) return false; | 314 if (other is! TypeUse) return false; |
315 return type == other.type && kind == other.kind; | 315 return type == other.type && kind == other.kind; |
316 } | 316 } |
317 | 317 |
318 String toString() => 'TypeUse($type,$kind)'; | 318 String toString() => 'TypeUse($type,$kind)'; |
319 } | 319 } |
OLD | NEW |