Index: pkg/compiler/lib/src/universe/world_impact.dart |
diff --git a/pkg/compiler/lib/src/universe/world_impact.dart b/pkg/compiler/lib/src/universe/world_impact.dart |
index 90120575b3fb147615ecce641fc69da545b4aa5a..2a1afb812b1bcae59b38f912e87d38558a3c2665 100644 |
--- a/pkg/compiler/lib/src/universe/world_impact.dart |
+++ b/pkg/compiler/lib/src/universe/world_impact.dart |
@@ -33,6 +33,8 @@ class WorldImpact { |
Iterable<TypeUse> get typeUses => const <TypeUse>[]; |
+ bool get isEmpty => true; |
+ |
void apply(WorldImpactVisitor visitor) { |
staticUses.forEach(visitor.visitStaticUse); |
dynamicUses.forEach(visitor.visitDynamicUse); |
@@ -74,6 +76,18 @@ class WorldImpactBuilderImpl extends WorldImpact implements WorldImpactBuilder { |
Set<StaticUse> _staticUses; |
Set<TypeUse> _typeUses; |
+ @override |
+ bool get isEmpty => |
+ _dynamicUses == null && _staticUses == null && _typeUses == null; |
+ |
+ /// Copy uses in [impact] to this impact builder. |
+ void addImpact(WorldImpact impact) { |
+ if (impact.isEmpty) return; |
+ impact.dynamicUses.forEach(registerDynamicUse); |
+ impact.staticUses.forEach(registerStaticUse); |
+ impact.typeUses.forEach(registerTypeUse); |
+ } |
+ |
void registerDynamicUse(DynamicUse dynamicUse) { |
assert(dynamicUse != null); |
if (_dynamicUses == null) { |
@@ -174,6 +188,14 @@ class TransformedWorldImpact implements WorldImpact, WorldImpactBuilder { |
TransformedWorldImpact(this.worldImpact); |
@override |
+ bool get isEmpty { |
+ return worldImpact.isEmpty && |
+ _staticUses == null && |
+ _typeUses == null && |
+ _dynamicUses == null; |
+ } |
+ |
+ @override |
Iterable<DynamicUse> get dynamicUses { |
return _dynamicUses != null ? _dynamicUses : worldImpact.dynamicUses; |
} |