Version 3.11.0-186.0.dev
Merge cb718f8ef1e9d892a9ee9680a9d1a05f06a289f3 into dev
diff --git a/DEPS b/DEPS
index 1cc52aa..c5f60db 100644
--- a/DEPS
+++ b/DEPS
@@ -54,7 +54,7 @@
# co19 is a cipd package automatically generated for each co19 commit.
# Use tests/co19/update.sh to update this hash.
- "co19_rev": "9b61c757d1373ef3ccf7db776c8520314fc843b9",
+ "co19_rev": "37c5e43f9cc4ebc67422cc5c27cf2b84919a5a71",
# The internal benchmarks to use. See go/dart-benchmarks-internal
"benchmarks_internal_rev": "6058722b4643b62c757dadc006f00bc3e14c4380",
diff --git a/pkg/dart2wasm/lib/modules.dart b/pkg/dart2wasm/lib/modules.dart
index fdaefae..083ca68 100644
--- a/pkg/dart2wasm/lib/modules.dart
+++ b/pkg/dart2wasm/lib/modules.dart
@@ -72,13 +72,6 @@
ModuleMetadata._(this.moduleImportName, this.moduleName,
{this.skipEmit = false, this.isMain = false});
- /// Whether or not the provided kernel [Reference] is included in this module.
- bool containsReference(Reference reference) {
- final enclosingLibrary = _enclosingLibraryForReference(reference);
- if (enclosingLibrary == null) return false;
- return libraries.contains(enclosingLibrary);
- }
-
@override
String toString() => '$moduleImportName($libraries)';
}
@@ -88,6 +81,12 @@
/// All [ModuleMetadata]s generated for the program.
final List<ModuleMetadata> modules;
+ /// Maps the [Library] to the corresponding [ModuleMetadata].
+ late final Map<Library, ModuleMetadata> _libraryToModuleMetadata = {
+ for (final metadata in modules)
+ for (final library in metadata.libraries) library: metadata,
+ };
+
ModuleOutputData(this.modules) : assert(modules[0].isMain);
ModuleMetadata get mainModule => modules[0];
@@ -96,8 +95,9 @@
bool get hasMultipleModules => modules.length > 1;
/// Returns the module that contains [reference].
- ModuleMetadata moduleForReference(Reference reference) =>
- modules.firstWhere((e) => e.containsReference(reference));
+ ModuleMetadata moduleForReference(Reference reference) {
+ return _libraryToModuleMetadata[_enclosingLibraryForReference(reference)]!;
+ }
}
/// Module strategy that puts all libraries into a single module.
diff --git a/tools/VERSION b/tools/VERSION
index 2d3ee8f..1f313e8 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 3
MINOR 11
PATCH 0
-PRERELEASE 185
+PRERELEASE 186
PRERELEASE_PATCH 0