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

Unified Diff: pkg/compiler/lib/src/library_loader.dart

Issue 1873573004: Serialize TreeElements (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Check only the last test to avoid timeout. Created 4 years, 8 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 | « pkg/compiler/lib/src/compiler.dart ('k') | pkg/compiler/lib/src/serialization/constant_serialization.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/library_loader.dart
diff --git a/pkg/compiler/lib/src/library_loader.dart b/pkg/compiler/lib/src/library_loader.dart
index 77d18aa9565586eb27511d4f2ca81aa8b54d51e3..b666bfa8955f2de879f4fe1cfb56b2226e4c1d5c 100644
--- a/pkg/compiler/lib/src/library_loader.dart
+++ b/pkg/compiler/lib/src/library_loader.dart
@@ -634,46 +634,49 @@ class _LibraryLoaderTask extends CompilerTask implements LibraryLoaderTask {
if (library != null) {
return new Future.value(library);
}
- library = deserializer.readLibrary(resolvedUri);
- if (library != null) {
- return loadDeserializedLibrary(handler, library);
- }
- return reporter.withCurrentElement(importingLibrary, () {
- return _readScript(node, readableUri, resolvedUri).then((Script script) {
- if (script == null) return null;
- LibraryElement element =
- createLibrarySync(handler, script, resolvedUri);
- CompilationUnitElementX compilationUnit = element.entryCompilationUnit;
- if (compilationUnit.partTag != null) {
- if (skipFileWithPartOfTag) {
- // TODO(johnniwinther): Avoid calling [listener.onLibraryCreated]
- // for this library.
- libraryCanonicalUriMap.remove(resolvedUri);
- return null;
- }
- if (importingLibrary == null) {
- DiagnosticMessage error = reporter.withCurrentElement(
- compilationUnit,
- () => reporter.createMessage(
- compilationUnit.partTag, MessageKind.MAIN_HAS_PART_OF));
- reporter.reportError(error);
- } else {
- DiagnosticMessage error = reporter.withCurrentElement(
- compilationUnit,
- () => reporter.createMessage(
- compilationUnit.partTag, MessageKind.IMPORT_PART_OF));
- DiagnosticMessage info = reporter.withCurrentElement(
- importingLibrary,
- () => reporter.createMessage(
- node, MessageKind.IMPORT_PART_OF_HERE));
- reporter.reportError(error, [info]);
+ return deserializer.readLibrary(resolvedUri).then((LibraryElement library) {
+ if (library != null) {
+ return loadDeserializedLibrary(handler, library);
+ }
+ return reporter.withCurrentElement(importingLibrary, () {
+ return _readScript(node, readableUri, resolvedUri)
+ .then((Script script) {
+ if (script == null) return null;
+ LibraryElement element =
+ createLibrarySync(handler, script, resolvedUri);
+ CompilationUnitElementX compilationUnit =
+ element.entryCompilationUnit;
+ if (compilationUnit.partTag != null) {
+ if (skipFileWithPartOfTag) {
+ // TODO(johnniwinther): Avoid calling [listener.onLibraryCreated]
+ // for this library.
+ libraryCanonicalUriMap.remove(resolvedUri);
+ return null;
+ }
+ if (importingLibrary == null) {
+ DiagnosticMessage error = reporter.withCurrentElement(
+ compilationUnit,
+ () => reporter.createMessage(
+ compilationUnit.partTag, MessageKind.MAIN_HAS_PART_OF));
+ reporter.reportError(error);
+ } else {
+ DiagnosticMessage error = reporter.withCurrentElement(
+ compilationUnit,
+ () => reporter.createMessage(
+ compilationUnit.partTag, MessageKind.IMPORT_PART_OF));
+ DiagnosticMessage info = reporter.withCurrentElement(
+ importingLibrary,
+ () => reporter.createMessage(
+ node, MessageKind.IMPORT_PART_OF_HERE));
+ reporter.reportError(error, [info]);
+ }
}
- }
- return processLibraryTags(handler, element).then((_) {
- reporter.withCurrentElement(element, () {
- handler.registerLibraryExports(element);
+ return processLibraryTags(handler, element).then((_) {
+ reporter.withCurrentElement(element, () {
+ handler.registerLibraryExports(element);
+ });
+ return element;
});
- return element;
});
});
});
« no previous file with comments | « pkg/compiler/lib/src/compiler.dart ('k') | pkg/compiler/lib/src/serialization/constant_serialization.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698