| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library dart2js.universe.world_impact; | 5 library dart2js.universe.world_impact; |
| 6 | 6 |
| 7 import '../elements/elements.dart' show Element; | 7 import '../elements/elements.dart' show Element; |
| 8 import '../util/util.dart' show Setlet; | 8 import '../util/util.dart' show Setlet; |
| 9 import 'use.dart' show DynamicUse, StaticUse, TypeUse; | 9 import 'use.dart' show DynamicUse, StaticUse, TypeUse; |
| 10 | 10 |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 | 254 |
| 255 const ImpactUseCase(this.name); | 255 const ImpactUseCase(this.name); |
| 256 | 256 |
| 257 String toString() => 'ImpactUseCase($name)'; | 257 String toString() => 'ImpactUseCase($name)'; |
| 258 } | 258 } |
| 259 | 259 |
| 260 /// Strategy used for processing [WorldImpact] object in various use cases. | 260 /// Strategy used for processing [WorldImpact] object in various use cases. |
| 261 class ImpactStrategy { | 261 class ImpactStrategy { |
| 262 const ImpactStrategy(); | 262 const ImpactStrategy(); |
| 263 | 263 |
| 264 /// Applies [impact] to [visitor] for the [impactUseCase] of [element]. | 264 /// Applies [impact] to [visitor] for the [impactUseCase] of [impactSource]. |
| 265 void visitImpact(Element element, WorldImpact impact, | 265 void visitImpact(var impactSource, WorldImpact impact, |
| 266 WorldImpactVisitor visitor, ImpactUseCase impactUseCase) { | 266 WorldImpactVisitor visitor, ImpactUseCase impactUseCase) { |
| 267 // Apply unconditionally. | 267 // Apply unconditionally. |
| 268 impact.apply(visitor); | 268 impact.apply(visitor); |
| 269 } | 269 } |
| 270 | 270 |
| 271 /// Notifies the strategy that no more impacts of [impactUseCase] will be | 271 /// Notifies the strategy that no more impacts of [impactUseCase] will be |
| 272 /// applied. | 272 /// applied. |
| 273 void onImpactUsed(ImpactUseCase impactUseCase) { | 273 void onImpactUsed(ImpactUseCase impactUseCase) { |
| 274 // Do nothing. | 274 // Do nothing. |
| 275 } | 275 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 } | 312 } |
| 313 } | 313 } |
| 314 | 314 |
| 315 @override | 315 @override |
| 316 void visitTypeUse(TypeUse use) { | 316 void visitTypeUse(TypeUse use) { |
| 317 if (_visitTypeUse != null) { | 317 if (_visitTypeUse != null) { |
| 318 _visitTypeUse(use); | 318 _visitTypeUse(use); |
| 319 } | 319 } |
| 320 } | 320 } |
| 321 } | 321 } |
| OLD | NEW |