| 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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 } | 281 } |
| 282 | 282 |
| 283 /// Initialization of an instance field [element]. | 283 /// Initialization of an instance field [element]. |
| 284 factory StaticUse.fieldInit(FieldElement element) { | 284 factory StaticUse.fieldInit(FieldElement element) { |
| 285 assert(invariant(element, element.isInstanceMember, | 285 assert(invariant(element, element.isInstanceMember, |
| 286 message: "Field init element $element must be an instance field.")); | 286 message: "Field init element $element must be an instance field.")); |
| 287 return new StaticUse.internal(element, StaticUseKind.GENERAL); | 287 return new StaticUse.internal(element, StaticUseKind.GENERAL); |
| 288 } | 288 } |
| 289 | 289 |
| 290 /// Read access of an instance field or boxed field [element]. | 290 /// Read access of an instance field or boxed field [element]. |
| 291 factory StaticUse.fieldGet(Element element) { | 291 factory StaticUse.fieldGet(FieldElement element) { |
| 292 assert(invariant( | 292 assert(invariant( |
| 293 element, element.isInstanceMember || element is BoxFieldElement, | 293 element, element.isInstanceMember || element is BoxFieldElement, |
| 294 message: "Field init element $element must be an instance " | 294 message: "Field init element $element must be an instance " |
| 295 "or boxed field.")); | 295 "or boxed field.")); |
| 296 return new StaticUse.internal(element, StaticUseKind.FIELD_GET); | 296 return new StaticUse.internal(element, StaticUseKind.FIELD_GET); |
| 297 } | 297 } |
| 298 | 298 |
| 299 /// Write access of an instance field or boxed field [element]. | 299 /// Write access of an instance field or boxed field [element]. |
| 300 factory StaticUse.fieldSet(Element element) { | 300 factory StaticUse.fieldSet(FieldElement element) { |
| 301 assert(invariant( | 301 assert(invariant( |
| 302 element, element.isInstanceMember || element is BoxFieldElement, | 302 element, element.isInstanceMember || element is BoxFieldElement, |
| 303 message: "Field init element $element must be an instance " | 303 message: "Field init element $element must be an instance " |
| 304 "or boxed field.")); | 304 "or boxed field.")); |
| 305 return new StaticUse.internal(element, StaticUseKind.FIELD_SET); | 305 return new StaticUse.internal(element, StaticUseKind.FIELD_SET); |
| 306 } | 306 } |
| 307 | 307 |
| 308 /// Read of a local function [element]. | 308 /// Read of a local function [element]. |
| 309 factory StaticUse.closure(LocalFunctionElement element) { | 309 factory StaticUse.closure(LocalFunctionElement element) { |
| 310 return new StaticUse.internal(element, StaticUseKind.CLOSURE); | 310 return new StaticUse.internal(element, StaticUseKind.CLOSURE); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 } | 393 } |
| 394 | 394 |
| 395 bool operator ==(other) { | 395 bool operator ==(other) { |
| 396 if (identical(this, other)) return true; | 396 if (identical(this, other)) return true; |
| 397 if (other is! TypeUse) return false; | 397 if (other is! TypeUse) return false; |
| 398 return type == other.type && kind == other.kind; | 398 return type == other.type && kind == other.kind; |
| 399 } | 399 } |
| 400 | 400 |
| 401 String toString() => 'TypeUse($type,$kind)'; | 401 String toString() => 'TypeUse($type,$kind)'; |
| 402 } | 402 } |
| OLD | NEW |