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

Unified Diff: pkg/front_end/lib/src/incremental_kernel_generator_impl.dart

Issue 2885883002: Fix computing export scopes for library cycles and after loading. (Closed)
Patch Set: Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/front_end/test/incremental_kernel_generator_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/lib/src/incremental_kernel_generator_impl.dart
diff --git a/pkg/front_end/lib/src/incremental_kernel_generator_impl.dart b/pkg/front_end/lib/src/incremental_kernel_generator_impl.dart
index 1992ba905add5bd7d127e61850f7c1805f15f95a..92506535f62344877490cf89996a40bbff50034e 100644
--- a/pkg/front_end/lib/src/incremental_kernel_generator_impl.dart
+++ b/pkg/front_end/lib/src/incremental_kernel_generator_impl.dart
@@ -159,7 +159,7 @@ class IncrementalKernelGeneratorImpl implements IncrementalKernelGenerator {
_logger.writeln('Signature: $signature.');
String kernelKey = '$signature.kernel';
- /// We need kernel libraries for these URIs.
+ // We need kernel libraries for these URIs.
Set<Uri> libraryUris = new Set<Uri>();
Map<Uri, FileState> libraryUriToFile = {};
for (FileState library in cycle.libraries) {
@@ -168,25 +168,31 @@ class IncrementalKernelGeneratorImpl implements IncrementalKernelGenerator {
libraryUriToFile[uri] = library;
}
- /// Check if there is already a bundle with these libraries.
+ Future<Null> appendNewDillLibraries(Program program) async {
+ List<DillLibraryBuilder> libraryBuilders = dillTarget.loader
+ .appendLibraries(program, (uri) => libraryUris.contains(uri));
+
+ // Compute local scopes.
+ await dillTarget.writeOutline(null);
+
+ // Compute export scopes.
+ _computeExportScopes(dillTarget, libraryUriToFile, libraryBuilders);
+ }
+
+ // Check if there is already a bundle with these libraries.
List<int> bytes = _byteStore.get(kernelKey);
if (bytes != null) {
- return _logger.run('Read serialized libraries', () {
+ return _logger.runAsync('Read serialized libraries', () async {
var program = new Program(nameRoot: nameRoot);
var reader = new BinaryBuilder(bytes);
reader.readProgram(program);
- List<DillLibraryBuilder> libraryBuilders = dillTarget.loader
- .appendLibraries(program, (uri) => libraryUris.contains(uri));
- _computeExportScopes(dillTarget, libraryUriToFile, libraryBuilders);
+ await appendNewDillLibraries(program);
return new _LibraryCycleResult(cycle, signature, program.libraries);
});
}
- // Ask DILL to fill outlines using loaded libraries.
- await dillTarget.writeOutline(null);
-
// Create KernelTarget and configure it for compiling the cycle URIs.
KernelTarget kernelTarget = new KernelTarget(_fsState.fileSystemView,
dillTarget, _uriTranslator, _options.strongMode);
@@ -195,19 +201,18 @@ class IncrementalKernelGeneratorImpl implements IncrementalKernelGenerator {
}
// Compile the cycle libraries into a new full program.
- Program program = await _logger.runAsync(
- 'Compile ${cycle.libraries.length} cycle libraries', () async {
+ Program program = await _logger
+ .runAsync('Compile ${cycle.libraries.length} libraries', () async {
await kernelTarget.writeOutline(null, nameRoot: nameRoot);
return await kernelTarget.writeProgram(null);
});
// Add newly compiled libraries into DILL.
+ await appendNewDillLibraries(program);
+
List<Library> kernelLibraries = program.libraries
.where((library) => libraryUris.contains(library.importUri))
.toList();
- List<DillLibraryBuilder> libraryBuilders = dillTarget.loader
- .appendLibraries(program, (uri) => libraryUris.contains(uri));
- _computeExportScopes(dillTarget, libraryUriToFile, libraryBuilders);
_logger.run('Serialize ${kernelLibraries.length} libraries', () {
program.unbindCanonicalNames();
« no previous file with comments | « no previous file | pkg/front_end/test/incremental_kernel_generator_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698