Chromium Code Reviews| 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 fe77fd4bcad0d127e722fd624772f0631cb09b2a..43b3ebb684c052ad2622646b735946ec6cd39372 100644 |
| --- a/pkg/compiler/lib/src/deferred_load.dart |
| +++ b/pkg/compiler/lib/src/deferred_load.dart |
| @@ -261,20 +261,6 @@ class DeferredLoadTask extends CompilerTask { |
| _constantToOutputUnit[constant] = _getCanonicalUnit(outputUnit); |
| } |
| - /// Answers whether [element] is explicitly deferred when referred to from |
| - /// [library]. |
| - bool _isExplicitlyDeferred(Element element, LibraryElement library) { |
| - Iterable<ImportElement> imports = _getImports(element, library); |
| - // If the element is not imported explicitly, it is implicitly imported |
| - // not deferred. |
| - if (imports.isEmpty) return false; |
| - // An element could potentially be loaded by several imports. If all of them |
| - // is explicitly deferred, we say the element is explicitly deferred. |
| - // TODO(sigurdm): We might want to give a warning if the imports do not |
| - // agree. |
| - return imports.every((ImportElement import) => import.isDeferred); |
| - } |
| - |
| /// Returns every [ImportElement] that imports [element] into [library]. |
| Iterable<ImportElement> _getImports(Element element, LibraryElement library) { |
| if (element.isClassMember) { |
| @@ -558,8 +544,19 @@ class DeferredLoadTask extends CompilerTask { |
| } |
| for (Element dependency in dependentElements) { |
| - if (_isExplicitlyDeferred(dependency, library)) { |
| - for (ImportElement deferredImport in _getImports(dependency, library)) { |
| + Iterable<ImportElement> imports = _getImports(dependency, library); |
|
sra1
2017/08/16 01:09:22
Presumably this is actually a List.
Siggi Cherem (dart-lang)
2017/08/16 01:18:20
Ack - I'm using the declared type for now. I feel
|
| + bool isExplicitlyDeferred = |
|
sra1
2017/08/16 01:09:22
This can still be a function, just taking the iter
Siggi Cherem (dart-lang)
2017/08/16 01:18:20
Done. Moved it was it used to be, but made the lis
|
| + // If the element is not imported explicitly, it is implicitly |
| + // imported not deferred. |
| + !imports.isEmpty && |
| + // An element could potentially be loaded by several imports. If |
| + // all of them are explicitly deferred, we say the element is |
| + // explicitly deferred. |
| + // TODO(sigurdm): We might want to give a warning if the imports |
| + // do not agree. |
| + imports.every((i) => i.isDeferred); |
| + if (isExplicitlyDeferred) { |
| + for (ImportElement deferredImport in imports) { |
| _mapDependencies( |
| element: dependency, |
| import: new _DeclaredDeferredImport(deferredImport)); |