Allow component to easily adopt libraries at will
Change-Id: Ia84d56b4c7d7403467b04e90c2b63859ecee509d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96042
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
diff --git a/pkg/kernel/lib/ast.dart b/pkg/kernel/lib/ast.dart
index 939af1f..0f9cfa4 100644
--- a/pkg/kernel/lib/ast.dart
+++ b/pkg/kernel/lib/ast.dart
@@ -5585,6 +5585,10 @@
: root = nameRoot ?? new CanonicalName.root(),
libraries = libraries ?? <Library>[],
uriToSource = uriToSource ?? <Uri, Source>{} {
+ adoptChildren();
+ }
+
+ void adoptChildren() {
if (libraries != null) {
for (int i = 0; i < libraries.length; ++i) {
// The libraries are owned by this component, and so are their canonical