Fix the order during building library scopes.
We should add local declarations to the export scope first.
R=brianwilkerson@google.com
Change-Id: I0f918be9ea16519c5670fb24236c85d1755f9eea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101140
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
diff --git a/pkg/analyzer/lib/src/summary2/link.dart b/pkg/analyzer/lib/src/summary2/link.dart
index c1a1aeb..dce55d8 100644
--- a/pkg/analyzer/lib/src/summary2/link.dart
+++ b/pkg/analyzer/lib/src/summary2/link.dart
@@ -108,12 +108,6 @@
_createLinkingBundle();
}
- void _addExporters() {
- for (var library in builders.values) {
- library.addExporters();
- }
- }
-
void _addSyntheticConstructors() {
for (var library in builders.values) {
library.addSyntheticConstructors();
@@ -122,7 +116,6 @@
void _buildOutlines() {
_resolveUriDirectives();
- _addExporters();
_computeLibraryScopes();
_addSyntheticConstructors();
_createTypeSystem();
@@ -144,11 +137,22 @@
}
void _computeLibraryScopes() {
+ for (var library in builders.values) {
+ library.addLocalDeclarations();
+ }
+
+ for (var library in builders.values) {
+ library.buildInitialExportScope();
+ }
+
var exporters = new Set<SourceLibraryBuilder>();
var exportees = new Set<SourceLibraryBuilder>();
for (var library in builders.values) {
- library.addLocalDeclarations();
+ library.addExporters();
+ }
+
+ for (var library in builders.values) {
if (library.exporters.isNotEmpty) {
exportees.add(library);
for (var exporter in library.exporters) {
@@ -157,10 +161,6 @@
}
}
- for (var library in builders.values) {
- library.buildInitialExportScope();
- }
-
var both = new Set<SourceLibraryBuilder>();
for (var exported in exportees) {
if (exporters.contains(exported)) {