| 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 |
| 11 /// * a call to the `foo()` method on an unknown class. | 11 /// * a call to the `foo()` method on an unknown class. |
| 12 /// * an instantiation of class T | 12 /// * an instantiation of class T |
| 13 /// | 13 /// |
| 14 /// The different compiler stages combine these uses into `WorldImpact` objects, | 14 /// The different compiler stages combine these uses into `WorldImpact` objects, |
| 15 /// which are later used to construct a closed-world understanding of the | 15 /// which are later used to construct a closed-world understanding of the |
| 16 /// program. | 16 /// program. |
| 17 library dart2js.universe.use; | 17 library dart2js.universe.use; |
| 18 | 18 |
| 19 import '../closure.dart' show BoxFieldElement; | 19 import '../closure.dart' show BoxFieldElement; |
| 20 import '../common.dart'; | 20 import '../common.dart'; |
| 21 import '../dart_types.dart'; | 21 import '../dart_types.dart'; |
| 22 import '../elements/elements.dart'; | 22 import '../elements/elements.dart'; |
| 23 import '../util/util.dart' show Hashing; | 23 import '../util/util.dart' show Hashing; |
| 24 import '../world.dart' show World; | 24 import '../world.dart' show World; |
| 25 import 'call_structure.dart' show CallStructure; | 25 import 'call_structure.dart' show CallStructure; |
| 26 import 'selector.dart' show Selector; | 26 import 'selector.dart' show Selector; |
| 27 import 'world_builder.dart' show ReceiverConstraint; | 27 import 'world_builder.dart' show ReceiverConstraint; |
| 28 | 28 |
| 29 enum DynamicUseKind { INVOKE, GET, SET, } | 29 enum DynamicUseKind { |
| 30 INVOKE, |
| 31 GET, |
| 32 SET, |
| 33 } |
| 30 | 34 |
| 31 /// The use of a dynamic property. [selector] defined the name and kind of the | 35 /// 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 | 36 /// property and [mask] defines the known constraint for the object on which |
| 33 /// the property is accessed. | 37 /// the property is accessed. |
| 34 class DynamicUse { | 38 class DynamicUse { |
| 35 final Selector selector; | 39 final Selector selector; |
| 36 final ReceiverConstraint mask; | 40 final ReceiverConstraint mask; |
| 37 | 41 |
| 38 DynamicUse(this.selector, this.mask); | 42 DynamicUse(this.selector, this.mask); |
| 39 | 43 |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 } | 393 } |
| 390 | 394 |
| 391 bool operator ==(other) { | 395 bool operator ==(other) { |
| 392 if (identical(this, other)) return true; | 396 if (identical(this, other)) return true; |
| 393 if (other is! TypeUse) return false; | 397 if (other is! TypeUse) return false; |
| 394 return type == other.type && kind == other.kind; | 398 return type == other.type && kind == other.kind; |
| 395 } | 399 } |
| 396 | 400 |
| 397 String toString() => 'TypeUse($type,$kind)'; | 401 String toString() => 'TypeUse($type,$kind)'; |
| 398 } | 402 } |
| OLD | NEW |