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

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

Issue 2024783003: Support references to unserialized libraries. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 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 | « pkg/compiler/lib/src/library_loader.dart ('k') | pkg/compiler/lib/src/serialization/system.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/serialization/serialization.dart
diff --git a/pkg/compiler/lib/src/serialization/serialization.dart b/pkg/compiler/lib/src/serialization/serialization.dart
index 74dd4a09509557d3553e62c595fcb051206306b4..1b97c3d9a57632bb59ee6859384f8501bd8a677a 100644
--- a/pkg/compiler/lib/src/serialization/serialization.dart
+++ b/pkg/compiler/lib/src/serialization/serialization.dart
@@ -5,9 +5,11 @@
library dart2js.serialization;
import '../common.dart';
+import '../common/resolution.dart';
import '../constants/expressions.dart';
import '../dart_types.dart';
import '../elements/elements.dart';
+import '../library_loader.dart' show LibraryProvider;
import '../util/enumset.dart';
import 'constant_serialization.dart';
@@ -921,13 +923,17 @@ class DeserializerPlugin {
/// Context for parallel deserialization.
class DeserializationContext {
final DiagnosticReporter reporter;
+ final Resolution resolution;
+ final LibraryProvider libraryProvider;
Map<Uri, LibraryElement> _uriMap = <Uri, LibraryElement>{};
List<Deserializer> deserializers = <Deserializer>[];
List<DeserializerPlugin> plugins = <DeserializerPlugin>[];
- DeserializationContext(this.reporter);
+ DeserializationContext(this.reporter, this.resolution, this.libraryProvider);
LibraryElement lookupLibrary(Uri uri) {
+ // TODO(johnniwinther): Move this to the library loader by making a
+ // [Deserializer] a [LibraryProvider].
return _uriMap.putIfAbsent(uri, () {
Uri foundUri;
LibraryElement foundLibrary;
@@ -949,6 +955,11 @@ class DeserializationContext {
return foundLibrary;
});
}
+
+ LibraryElement findLibrary(Uri uri) {
+ LibraryElement library = lookupLibrary(uri);
+ return library ?? libraryProvider.lookupLibrary(uri);
+ }
}
/// Deserializer for a closed collection of libraries.
@@ -1024,7 +1035,7 @@ class Deserializer {
decoder.getEnum(Key.KIND, SerializedElementKind.values);
if (elementKind == SerializedElementKind.EXTERNAL_LIBRARY) {
Uri uri = decoder.getUri(Key.URI);
- element = context.lookupLibrary(uri);
+ element = context.findLibrary(uri);
if (element == null) {
throw new StateError("Missing library for $uri.");
}
@@ -1047,6 +1058,7 @@ class Deserializer {
}
} else if (elementKind == SerializedElementKind.EXTERNAL_CLASS_MEMBER) {
ClassElement cls = decoder.getElement(Key.CLASS);
+ cls.ensureResolved(context.resolution);
String name = decoder.getString(Key.NAME);
bool isGetter = decoder.getBool(Key.GETTER, isOptional: true);
element = cls.lookupLocalMember(name);
@@ -1063,6 +1075,7 @@ class Deserializer {
}
} else if (elementKind == SerializedElementKind.EXTERNAL_CONSTRUCTOR) {
ClassElement cls = decoder.getElement(Key.CLASS);
+ cls.ensureResolved(context.resolution);
String name = decoder.getString(Key.NAME);
element = cls.lookupConstructor(name);
if (element == null) {
« no previous file with comments | « pkg/compiler/lib/src/library_loader.dart ('k') | pkg/compiler/lib/src/serialization/system.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698