| Index: pkg/analyzer/tool/summary/dump_inferred_types.dart
|
| diff --git a/pkg/analyzer/tool/summary/dump_inferred_types.dart b/pkg/analyzer/tool/summary/dump_inferred_types.dart
|
| index bb7073416bdfd9a13f67798952aa0385e93f4bb0..a964675ff922dcb50784b50a4f297820e4cf3cee 100644
|
| --- a/pkg/analyzer/tool/summary/dump_inferred_types.dart
|
| +++ b/pkg/analyzer/tool/summary/dump_inferred_types.dart
|
| @@ -18,8 +18,10 @@ main(List<String> args) {
|
| for (String arg in args) {
|
| PackageBundle bundle =
|
| new PackageBundle.fromBuffer(new File(arg).readAsBytesSync());
|
| - collector.visitPackageBundle(bundle);
|
| + collector.visitPackageBundle(bundle, arg);
|
| }
|
| + collector.dumpLibraryIndex();
|
| + collector.dumpPartIndex();
|
| collector.dumpCollectedTypes();
|
| }
|
|
|
| @@ -32,6 +34,8 @@ class InferredTypeCollector {
|
| LinkedUnit linkedUnit;
|
| final Map<String, String> inferredTypes = <String, String>{};
|
| List<String> typeParamsInScope = <String>[];
|
| + final Map<String, Set<String>> libraryIndex = <String, Set<String>>{};
|
| + final Map<String, Set<String>> partIndex = <String, Set<String>>{};
|
|
|
| /**
|
| * If an inferred type exists matching the given [slot], record that it is the
|
| @@ -81,6 +85,7 @@ class InferredTypeCollector {
|
| * Print out all the inferred types collected so far, in alphabetical order.
|
| */
|
| void dumpCollectedTypes() {
|
| + print('Collected types (${inferredTypes.length}):');
|
| List<String> paths = inferredTypes.keys.toList();
|
| paths.sort();
|
| for (String path in paths) {
|
| @@ -89,6 +94,38 @@ class InferredTypeCollector {
|
| }
|
|
|
| /**
|
| + * Print out an index mapping library names to the summary files containing
|
| + * them.
|
| + */
|
| + void dumpLibraryIndex() {
|
| + print('Library index:');
|
| + List<String> libraryNames = libraryIndex.keys.toList();
|
| + libraryNames.sort();
|
| + for (String libraryName in libraryNames) {
|
| + List<String> summaryFiles = libraryIndex[libraryName].toList();
|
| + summaryFiles.sort();
|
| + print('$libraryName -> ${summaryFiles.join(', ')}');
|
| + }
|
| + print('');
|
| + }
|
| +
|
| + /**
|
| + * Print out an index mapping part file names to the summary files containing
|
| + * them.
|
| + */
|
| + void dumpPartIndex() {
|
| + print('Part index:');
|
| + List<String> partNames = partIndex.keys.toList();
|
| + partNames.sort();
|
| + for (String partName in partNames) {
|
| + List<String> summaryFiles = partIndex[partName].toList();
|
| + summaryFiles.sort();
|
| + print('$partName -> ${summaryFiles.join(', ')}');
|
| + }
|
| + print('');
|
| + }
|
| +
|
| + /**
|
| * Interpret the given [param] as a parameter in a synthetic typedef, and
|
| * format it as a string.
|
| */
|
| @@ -243,14 +280,18 @@ class InferredTypeCollector {
|
| /**
|
| * Collect all the inferred types contained in [bundle].
|
| */
|
| - void visitPackageBundle(PackageBundle bundle) {
|
| + void visitPackageBundle(PackageBundle bundle, String summaryPath) {
|
| Map<String, LinkedLibrary> linkedLibraries = <String, LinkedLibrary>{};
|
| Map<String, UnlinkedUnit> unlinkedUnits = <String, UnlinkedUnit>{};
|
| for (int i = 0; i < bundle.linkedLibraryUris.length; i++) {
|
| linkedLibraries[bundle.linkedLibraryUris[i]] = bundle.linkedLibraries[i];
|
| }
|
| for (int i = 0; i < bundle.unlinkedUnitUris.length; i++) {
|
| - unlinkedUnits[bundle.unlinkedUnitUris[i]] = bundle.unlinkedUnits[i];
|
| + String unitUriString = bundle.unlinkedUnitUris[i];
|
| + partIndex
|
| + .putIfAbsent(unitUriString, () => new Set<String>())
|
| + .add(summaryPath);
|
| + unlinkedUnits[unitUriString] = bundle.unlinkedUnits[i];
|
| }
|
| // Figure out which unlinked units are a part of another library so we won't
|
| // visit them redundantly.
|
| @@ -268,6 +309,9 @@ class InferredTypeCollector {
|
| if (partOfUris.contains(libraryUriString)) {
|
| return;
|
| }
|
| + libraryIndex
|
| + .putIfAbsent(libraryUriString, () => new Set<String>())
|
| + .add(summaryPath);
|
| Uri libraryUri = Uri.parse(libraryUriString);
|
| UnlinkedUnit definingUnlinkedUnit = unlinkedUnits[libraryUriString];
|
| if (definingUnlinkedUnit != null) {
|
|
|