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

Unified Diff: pkg/front_end/lib/src/fasta/source/source_library_builder.dart

Issue 3009953003: Store actual Reference(s) for additional exports. (Closed)
Patch Set: Use references, but keep JSON hacks for errors and void/dynamic. Created 3 years, 3 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/front_end/lib/src/fasta/source/source_library_builder.dart
diff --git a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
index cfbb348487164abadefee701b5bcd32338adfc03..b3210f98ac862ffb38229f13465e7e3ef25a28bd 100644
--- a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
@@ -54,8 +54,6 @@ import '../import.dart' show Import;
import '../problems.dart' show unhandled;
-import '../util/relativize.dart' show relativizeUri;
-
import 'source_loader.dart' show SourceLoader;
abstract class SourceLibraryBuilder<T extends TypeBuilder, R>
@@ -99,11 +97,16 @@ abstract class SourceLibraryBuilder<T extends TypeBuilder, R>
bool canAddImplementationBuilders = false;
- /// Exports in addition to the members declared in this library.
+ /// Exports that can't be serialized.
+ ///
+ /// The key is the name of the exported member.
///
- /// See [../dill/dill_library_builder.dart] for additional details on the
- /// format used.
- List<List<String>> additionalExports;
+ /// If the name is `dynamic` or `void`, this library reexports the
+ /// corresponding type from `dart:core`, and the value is null.
+ ///
+ /// Otherwise, this represents an error (an ambiguous export). In this case,
+ /// the error message is the corresponding value in the map.
+ Map<String, String> additionalExports;
SourceLibraryBuilder(SourceLoader loader, Uri fileUri)
: this.fromScopes(loader, fileUri, new DeclarationBuilder<T>.library(),
@@ -524,17 +527,20 @@ abstract class SourceLibraryBuilder<T extends TypeBuilder, R>
}
exportScope.forEach((String name, Builder member) {
if (member.parent != this) {
- additionalExports ??= <List<String>>[];
- Builder parent = member.parent;
- if (parent is LibraryBuilder) {
- additionalExports.add(<String>[
- relativizeUri(parent.uri, base: uri.resolve(".")),
- name
- ]);
- } else {
- InvalidTypeBuilder invalidType = member;
- String message = invalidType.message.message;
- additionalExports.add(<String>[null, name, message]);
+ switch (name) {
+ case "dynamic":
+ case "void":
+ additionalExports ??= <String, String>{};
+ additionalExports[name] = null;
+ break;
+
+ default:
+ if (member is InvalidTypeBuilder) {
+ additionalExports ??= <String, String>{};
+ additionalExports[name] = member.message.message;
+ } else {
+ target.additionalExports.add(member.target.reference);
ahe 2017/09/01 14:05:39 I had to move this to kernel_library_builder.dart,
+ }
}
}
});

Powered by Google App Engine
This is Rietveld 408576698