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 '../dart_types.dart' show | 7 import '../dart_types.dart' show |
8 DartType, | 8 DartType, |
9 InterfaceType; | 9 InterfaceType; |
10 import '../elements/elements.dart' show | 10 import '../elements/elements.dart' show |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 add('type uses', worldImpact.typeUses); | 55 add('type uses', worldImpact.typeUses); |
56 } | 56 } |
57 } | 57 } |
58 | 58 |
59 class WorldImpactBuilder { | 59 class WorldImpactBuilder { |
60 // TODO(johnniwinther): Do we benefit from lazy initialization of the | 60 // TODO(johnniwinther): Do we benefit from lazy initialization of the |
61 // [Setlet]s? | 61 // [Setlet]s? |
62 Setlet<DynamicUse> _dynamicUses; | 62 Setlet<DynamicUse> _dynamicUses; |
63 Setlet<StaticUse> _staticUses; | 63 Setlet<StaticUse> _staticUses; |
64 Setlet<TypeUse> _typeUses; | 64 Setlet<TypeUse> _typeUses; |
65 Setlet<LocalFunctionElement> _closures; | |
66 | 65 |
67 void registerDynamicUse(DynamicUse dynamicUse) { | 66 void registerDynamicUse(DynamicUse dynamicUse) { |
68 assert(dynamicUse != null); | 67 assert(dynamicUse != null); |
69 if (_dynamicUses == null) { | 68 if (_dynamicUses == null) { |
70 _dynamicUses = new Setlet<DynamicUse>(); | 69 _dynamicUses = new Setlet<DynamicUse>(); |
71 } | 70 } |
72 _dynamicUses.add(dynamicUse); | 71 _dynamicUses.add(dynamicUse); |
73 } | 72 } |
74 | 73 |
75 Iterable<DynamicUse> get dynamicUses { | 74 Iterable<DynamicUse> get dynamicUses { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 return _staticUses != null ? _staticUses : worldImpact.staticUses; | 154 return _staticUses != null ? _staticUses : worldImpact.staticUses; |
156 } | 155 } |
157 | 156 |
158 String toString() { | 157 String toString() { |
159 StringBuffer sb = new StringBuffer(); | 158 StringBuffer sb = new StringBuffer(); |
160 sb.write('TransformedWorldImpact($worldImpact)'); | 159 sb.write('TransformedWorldImpact($worldImpact)'); |
161 WorldImpact.printOn(sb, this); | 160 WorldImpact.printOn(sb, this); |
162 return sb.toString(); | 161 return sb.toString(); |
163 } | 162 } |
164 } | 163 } |
OLD | NEW |