Chromium Code Reviews| 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 50cb902976812fc42c8d3cfb702f0a0a542b4def..35ab8e6ff86eb990eb13331a4f19ae576dd70572 100644 |
| --- a/pkg/compiler/lib/src/universe/world_impact.dart |
| +++ b/pkg/compiler/lib/src/universe/world_impact.dart |
| @@ -40,15 +40,22 @@ class WorldImpact { |
| Iterable<DartType> get asCasts => const <DartType>[]; |
| + Iterable<DartType> get onCatchTypes => const <DartType>[]; |
| + |
| Iterable<MethodElement> get closurizedFunctions => const <MethodElement>[]; |
| Iterable<LocalFunctionElement> get closures => const <LocalFunctionElement>[]; |
| Iterable<DartType> get typeLiterals => const <DartType>[]; |
| - String toString() { |
| - StringBuffer sb = new StringBuffer(); |
| + String toString() => dump(this); |
| + static String dump(WorldImpact worldImpact) { |
| + StringBuffer sb = new StringBuffer(); |
| + printOn(sb, worldImpact); |
| + return sb.toString(); |
| + } |
|
sigurdm
2015/10/22 09:18:03
empty line between members
Johnni Winther
2015/10/22 10:31:55
Done.
|
| + static void printOn(StringBuffer sb, WorldImpact worldImpact) { |
|
sigurdm
2015/10/22 09:18:03
Why is this static?
Johnni Winther
2015/10/22 10:31:55
So it can be required between for subclasses and s
|
| void add(String title, Iterable iterable) { |
| if (iterable.isNotEmpty) { |
| sb.write('\n $title:'); |
| @@ -56,19 +63,18 @@ class WorldImpact { |
| } |
| } |
| - add('dynamic invocations', dynamicInvocations); |
| - add('dynamic getters', dynamicGetters); |
| - add('dynamic setters', dynamicSetters); |
| - add('static uses', staticUses); |
| - add('instantiated types', instantiatedTypes); |
| - add('is-checks', isChecks); |
| - add('checked-mode checks', checkedModeChecks); |
| - add('as-casts', asCasts); |
| - add('closurized functions', closurizedFunctions); |
| - add('closures', closures); |
| - add('type literals', typeLiterals); |
| - |
| - return sb.toString(); |
| + add('dynamic invocations', worldImpact.dynamicInvocations); |
| + add('dynamic getters', worldImpact.dynamicGetters); |
| + add('dynamic setters', worldImpact.dynamicSetters); |
| + add('static uses', worldImpact.staticUses); |
| + add('instantiated types', worldImpact.instantiatedTypes); |
| + add('is-checks', worldImpact.isChecks); |
| + add('checked-mode checks', worldImpact.checkedModeChecks); |
| + add('as-casts', worldImpact.asCasts); |
| + add('on-catch-types', worldImpact.onCatchTypes); |
| + add('closurized functions', worldImpact.closurizedFunctions); |
| + add('closures', worldImpact.closures); |
| + add('type literals', worldImpact.typeLiterals); |
| } |
| } |
| @@ -83,6 +89,7 @@ class WorldImpactBuilder { |
| Setlet<DartType> _isChecks; |
| Setlet<DartType> _asCasts; |
| Setlet<DartType> _checkedModeChecks; |
| + Setlet<DartType> _onCatchTypes; |
| Setlet<MethodElement> _closurizedFunctions; |
| Setlet<LocalFunctionElement> _closures; |
| Setlet<DartType> _typeLiterals; |
| @@ -201,6 +208,19 @@ class WorldImpactBuilder { |
| ? _checkedModeChecks : const <DartType>[]; |
| } |
| + void registerOnCatchType(DartType type) { |
| + assert(type != null); |
| + if (_onCatchTypes == null) { |
| + _onCatchTypes = new Setlet<DartType>(); |
| + } |
| + _onCatchTypes.add(type); |
| + } |
| + |
| + Iterable<DartType> get onCatchTypes { |
| + return _onCatchTypes != null |
| + ? _onCatchTypes : const <DartType>[]; |
| + } |
| + |
| void registerClosurizedFunction(MethodElement element) { |
| if (_closurizedFunctions == null) { |
| _closurizedFunctions = new Setlet<MethodElement>(); |