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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 SUPER_TEAR_OFF, | 74 SUPER_TEAR_OFF, |
75 SUPER_FIELD_SET, | 75 SUPER_FIELD_SET, |
76 FIELD_GET, | 76 FIELD_GET, |
77 FIELD_SET, | 77 FIELD_SET, |
78 CLOSURE, | 78 CLOSURE, |
79 CONSTRUCTOR_INVOKE, | 79 CONSTRUCTOR_INVOKE, |
80 CONST_CONSTRUCTOR_INVOKE, | 80 CONST_CONSTRUCTOR_INVOKE, |
81 REDIRECTION, | 81 REDIRECTION, |
82 DIRECT_INVOKE, | 82 DIRECT_INVOKE, |
83 DIRECT_USE, | 83 DIRECT_USE, |
| 84 INLINING, |
84 } | 85 } |
85 | 86 |
86 /// Statically known use of an [Element]. | 87 /// Statically known use of an [Element]. |
87 // TODO(johnniwinther): Create backend-specific implementations with better | 88 // TODO(johnniwinther): Create backend-specific implementations with better |
88 // invariants. | 89 // invariants. |
89 class StaticUse { | 90 class StaticUse { |
90 final Entity element; | 91 final Entity element; |
91 final StaticUseKind kind; | 92 final StaticUseKind kind; |
92 final int hashCode; | 93 final int hashCode; |
93 final DartType type; | 94 final DartType type; |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 /// backend. | 332 /// backend. |
332 factory StaticUse.implicitInvoke(FunctionEntity element) { | 333 factory StaticUse.implicitInvoke(FunctionEntity element) { |
333 return new StaticUse.internal(element, StaticUseKind.GENERAL); | 334 return new StaticUse.internal(element, StaticUseKind.GENERAL); |
334 } | 335 } |
335 | 336 |
336 /// Direct use of [element] as done with `--analyze-all` and `--analyze-main`. | 337 /// Direct use of [element] as done with `--analyze-all` and `--analyze-main`. |
337 factory StaticUse.directUse(Entity element) { | 338 factory StaticUse.directUse(Entity element) { |
338 return new StaticUse.internal(element, StaticUseKind.DIRECT_USE); | 339 return new StaticUse.internal(element, StaticUseKind.DIRECT_USE); |
339 } | 340 } |
340 | 341 |
| 342 /// Inlining of [element]. |
| 343 factory StaticUse.inlining(FunctionEntity element) { |
| 344 return new StaticUse.internal(element, StaticUseKind.INLINING); |
| 345 } |
| 346 |
341 bool operator ==(other) { | 347 bool operator ==(other) { |
342 if (identical(this, other)) return true; | 348 if (identical(this, other)) return true; |
343 if (other is! StaticUse) return false; | 349 if (other is! StaticUse) return false; |
344 return element == other.element && kind == other.kind && type == other.type; | 350 return element == other.element && kind == other.kind && type == other.type; |
345 } | 351 } |
346 | 352 |
347 String toString() => 'StaticUse($element,$kind,$type)'; | 353 String toString() => 'StaticUse($element,$kind,$type)'; |
348 } | 354 } |
349 | 355 |
350 enum TypeUseKind { | 356 enum TypeUseKind { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 } | 416 } |
411 | 417 |
412 bool operator ==(other) { | 418 bool operator ==(other) { |
413 if (identical(this, other)) return true; | 419 if (identical(this, other)) return true; |
414 if (other is! TypeUse) return false; | 420 if (other is! TypeUse) return false; |
415 return type == other.type && kind == other.kind; | 421 return type == other.type && kind == other.kind; |
416 } | 422 } |
417 | 423 |
418 String toString() => 'TypeUse($type,$kind)'; | 424 String toString() => 'TypeUse($type,$kind)'; |
419 } | 425 } |
OLD | NEW |