| 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..bb6ac355a32783b9694fb33874dac21cacbdef25 100644
|
| --- a/pkg/compiler/lib/src/universe/world_impact.dart
|
| +++ b/pkg/compiler/lib/src/universe/world_impact.dart
|
| @@ -40,15 +40,23 @@ 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() {
|
| + String toString() => dump(this);
|
| +
|
| + static String dump(WorldImpact worldImpact) {
|
| StringBuffer sb = new StringBuffer();
|
| + printOn(sb, worldImpact);
|
| + return sb.toString();
|
| + }
|
|
|
| + static void printOn(StringBuffer sb, WorldImpact worldImpact) {
|
| void add(String title, Iterable iterable) {
|
| if (iterable.isNotEmpty) {
|
| sb.write('\n $title:');
|
| @@ -56,19 +64,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 +90,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 +209,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>();
|
|
|