| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 STATIC_TEAR_OFF, | 68 STATIC_TEAR_OFF, |
| 69 SUPER_TEAR_OFF, | 69 SUPER_TEAR_OFF, |
| 70 SUPER_FIELD_SET, | 70 SUPER_FIELD_SET, |
| 71 FIELD_GET, | 71 FIELD_GET, |
| 72 FIELD_SET, | 72 FIELD_SET, |
| 73 CLOSURE, | 73 CLOSURE, |
| 74 CONSTRUCTOR_INVOKE, | 74 CONSTRUCTOR_INVOKE, |
| 75 CONST_CONSTRUCTOR_INVOKE, | 75 CONST_CONSTRUCTOR_INVOKE, |
| 76 REDIRECTION, | 76 REDIRECTION, |
| 77 DIRECT_INVOKE, | 77 DIRECT_INVOKE, |
| 78 DIRECT_USE, |
| 78 } | 79 } |
| 79 | 80 |
| 80 /// Statically known use of an [Element]. | 81 /// Statically known use of an [Element]. |
| 81 // TODO(johnniwinther): Create backend-specific implementations with better | 82 // TODO(johnniwinther): Create backend-specific implementations with better |
| 82 // invariants. | 83 // invariants. |
| 83 class StaticUse { | 84 class StaticUse { |
| 84 final Element element; | 85 final Element element; |
| 85 final StaticUseKind kind; | 86 final StaticUseKind kind; |
| 86 final int hashCode; | 87 final int hashCode; |
| 87 final DartType type; | 88 final DartType type; |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 factory StaticUse.closure(LocalFunctionElement element) { | 305 factory StaticUse.closure(LocalFunctionElement element) { |
| 305 return new StaticUse.internal(element, StaticUseKind.CLOSURE); | 306 return new StaticUse.internal(element, StaticUseKind.CLOSURE); |
| 306 } | 307 } |
| 307 | 308 |
| 308 /// Unknown use of [element]. | 309 /// Unknown use of [element]. |
| 309 @deprecated | 310 @deprecated |
| 310 factory StaticUse.foreignUse(Element element) { | 311 factory StaticUse.foreignUse(Element element) { |
| 311 return new StaticUse.internal(element, StaticUseKind.GENERAL); | 312 return new StaticUse.internal(element, StaticUseKind.GENERAL); |
| 312 } | 313 } |
| 313 | 314 |
| 315 /// Direct use of [element] as done with `--analyze-all` and `--analyze-main`. |
| 316 factory StaticUse.directUse(Element element) { |
| 317 return new StaticUse.internal(element, StaticUseKind.DIRECT_USE); |
| 318 } |
| 319 |
| 314 bool operator ==(other) { | 320 bool operator ==(other) { |
| 315 if (identical(this, other)) return true; | 321 if (identical(this, other)) return true; |
| 316 if (other is! StaticUse) return false; | 322 if (other is! StaticUse) return false; |
| 317 return element == other.element && kind == other.kind && type == other.type; | 323 return element == other.element && kind == other.kind && type == other.type; |
| 318 } | 324 } |
| 319 | 325 |
| 320 String toString() => 'StaticUse($element,$kind,$type)'; | 326 String toString() => 'StaticUse($element,$kind,$type)'; |
| 321 } | 327 } |
| 322 | 328 |
| 323 enum TypeUseKind { | 329 enum TypeUseKind { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 } | 389 } |
| 384 | 390 |
| 385 bool operator ==(other) { | 391 bool operator ==(other) { |
| 386 if (identical(this, other)) return true; | 392 if (identical(this, other)) return true; |
| 387 if (other is! TypeUse) return false; | 393 if (other is! TypeUse) return false; |
| 388 return type == other.type && kind == other.kind; | 394 return type == other.type && kind == other.kind; |
| 389 } | 395 } |
| 390 | 396 |
| 391 String toString() => 'TypeUse($type,$kind)'; | 397 String toString() => 'TypeUse($type,$kind)'; |
| 392 } | 398 } |
| OLD | NEW |