Index: pkg/compiler/lib/src/deferred_load.dart |
diff --git a/pkg/compiler/lib/src/deferred_load.dart b/pkg/compiler/lib/src/deferred_load.dart |
index b4ef154f4a0e134a4ebbe6326991f26ff048c9fe..2cd08666d72248d7548290bca9c27f852bba9bca 100644 |
--- a/pkg/compiler/lib/src/deferred_load.dart |
+++ b/pkg/compiler/lib/src/deferred_load.dart |
@@ -201,9 +201,20 @@ class DeferredLoadTask extends CompilerTask { |
return outputUnitForElement(element) != mainOutputUnit; |
} |
- /// Returns true if e1 and e2 are in the same output unit. |
- bool inSameOutputUnit(Element e1, Element e2) { |
- return outputUnitForElement(e1) == outputUnitForElement(e2); |
+ /// Returns `true` if element [to] is reachable from element [from] without |
+ /// crossing a deferred import. |
+ /// |
+ /// For example, if we have two deferred libraries `A` and `B` that both |
+ /// import a library `C`, then even though elements from `A` and `C` end up in |
+ /// different output units, there is a non-deferred path between `A` and `C`. |
+ bool hasOnlyNonDeferredImportPaths(Element from, Element to) { |
+ OutputUnit outputUnitFrom = outputUnitForElement(from); |
+ OutputUnit outputUnitTo = outputUnitForElement(to); |
+ return outputUnitTo.imports.containsAll(outputUnitFrom.imports); |
+ } |
+ |
+ bool isFromMainOutputUnit(Element element) { |
+ return outputUnitForElement(element) == mainOutputUnit; |
} |
void registerConstantDeferredUse(DeferredConstantValue constant, |