Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Side by Side Diff: pkg/analyzer/tool/summary/build_sdk_summary.dart

Issue 1624853002: Store the result of type inference in summaries. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 import 'dart:io'; 1 import 'dart:io';
2 2
3 import 'package:analyzer/dart/element/element.dart'; 3 import 'package:analyzer/dart/element/element.dart';
4 import 'package:analyzer/src/generated/engine.dart'; 4 import 'package:analyzer/src/generated/engine.dart';
5 import 'package:analyzer/src/generated/java_io.dart'; 5 import 'package:analyzer/src/generated/java_io.dart';
6 import 'package:analyzer/src/generated/sdk.dart'; 6 import 'package:analyzer/src/generated/sdk.dart';
7 import 'package:analyzer/src/generated/sdk_io.dart'; 7 import 'package:analyzer/src/generated/sdk_io.dart';
8 import 'package:analyzer/src/generated/source.dart'; 8 import 'package:analyzer/src/generated/source.dart';
9 import 'package:analyzer/src/summary/format.dart'; 9 import 'package:analyzer/src/summary/format.dart';
10 import 'package:analyzer/src/summary/summarize_elements.dart'; 10 import 'package:analyzer/src/summary/summarize_elements.dart';
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 // 47 //
48 List<String> linkedLibraryUris = <String>[]; 48 List<String> linkedLibraryUris = <String>[];
49 List<LinkedLibraryBuilder> linkedLibraries = <LinkedLibraryBuilder>[]; 49 List<LinkedLibraryBuilder> linkedLibraries = <LinkedLibraryBuilder>[];
50 List<String> unlinkedUnitUris = <String>[]; 50 List<String> unlinkedUnitUris = <String>[];
51 List<UnlinkedUnitBuilder> unlinkedUnits = <UnlinkedUnitBuilder>[]; 51 List<UnlinkedUnitBuilder> unlinkedUnits = <UnlinkedUnitBuilder>[];
52 for (SdkLibrary lib in sdk.sdkLibraries) { 52 for (SdkLibrary lib in sdk.sdkLibraries) {
53 print('Resolving and serializing: ${lib.shortName}'); 53 print('Resolving and serializing: ${lib.shortName}');
54 Source librarySource = sdk.mapDartUri(lib.shortName); 54 Source librarySource = sdk.mapDartUri(lib.shortName);
55 LibraryElement libraryElement = 55 LibraryElement libraryElement =
56 context.computeLibraryElement(librarySource); 56 context.computeLibraryElement(librarySource);
57 // TODO(paulberry): also build a summary of the SDK in strong mode.
57 LibrarySerializationResult libraryResult = 58 LibrarySerializationResult libraryResult =
58 serializeLibrary(libraryElement, context.typeProvider); 59 serializeLibrary(libraryElement, context.typeProvider, false);
59 linkedLibraryUris.add(lib.shortName); 60 linkedLibraryUris.add(lib.shortName);
60 linkedLibraries.add(libraryResult.linked); 61 linkedLibraries.add(libraryResult.linked);
61 unlinkedUnitUris.addAll(libraryResult.unitUris); 62 unlinkedUnitUris.addAll(libraryResult.unitUris);
62 unlinkedUnits.addAll(libraryResult.unlinkedUnits); 63 unlinkedUnits.addAll(libraryResult.unlinkedUnits);
63 } 64 }
64 // 65 //
65 // Write the whole SDK bundle. 66 // Write the whole SDK bundle.
66 // 67 //
67 SdkBundleBuilder sdkBundle = new SdkBundleBuilder( 68 SdkBundleBuilder sdkBundle = new SdkBundleBuilder(
68 linkedLibraryUris: linkedLibraryUris, 69 linkedLibraryUris: linkedLibraryUris,
69 linkedLibraries: linkedLibraries, 70 linkedLibraries: linkedLibraries,
70 unlinkedUnitUris: unlinkedUnitUris, 71 unlinkedUnitUris: unlinkedUnitUris,
71 unlinkedUnits: unlinkedUnits); 72 unlinkedUnits: unlinkedUnits);
72 File file = new File(outputFilePath); 73 File file = new File(outputFilePath);
73 file.writeAsBytesSync(sdkBundle.toBuffer(), mode: FileMode.WRITE_ONLY); 74 file.writeAsBytesSync(sdkBundle.toBuffer(), mode: FileMode.WRITE_ONLY);
74 } 75 }
75 76
76 /** 77 /**
77 * The name of the SDK summary builder application. 78 * The name of the SDK summary builder application.
78 */ 79 */
79 const BINARY_NAME = "build_sdk_summary"; 80 const BINARY_NAME = "build_sdk_summary";
80 81
81 /** 82 /**
82 * Print information about how to use the SDK summary builder. 83 * Print information about how to use the SDK summary builder.
83 */ 84 */
84 void _printUsage() { 85 void _printUsage() {
85 print('Usage: $BINARY_NAME output_file_path [sdk_path]'); 86 print('Usage: $BINARY_NAME output_file_path [sdk_path]');
86 } 87 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698