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: 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
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 e6eaf88f8029627014f8eb6723ed7b5b79cc88dc..23eb238777a344c339f9682fdecfdf4067264c56 100644
--- a/pkg/compiler/lib/src/library_loader.dart
+++ b/pkg/compiler/lib/src/library_loader.dart
@@ -652,47 +652,50 @@ 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) {
Siggi Cherem (dart-lang) 2016/04/08 16:55:32 or use `await`?
Johnni Winther 2016/04/11 08:54:04 Aren't we still avoiding the using of async/await
Siggi Cherem (dart-lang) 2016/04/11 17:48:07 are they still blocked on that? I thought it was g
Johnni Winther 2016/04/12 08:05:47 I'll check with sgjesse and let you know.
+ 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;
});
});
});

Powered by Google App Engine
This is Rietveld 408576698