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..8c3cfb5dad2c28714af83a8d9643c793475b7688 100644 |
--- a/pkg/compiler/lib/src/deferred_load.dart |
+++ b/pkg/compiler/lib/src/deferred_load.dart |
@@ -201,9 +201,19 @@ 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 |
floitsch
2015/05/05 17:58:15
new line before.
herhut
2015/05/06 08:37:09
Done.
|
+ /// 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 hasNonDeferredImportPath(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, |