Chromium Code Reviews| Index: sdk/lib/_internal/compiler/implementation/deferred_load.dart |
| diff --git a/sdk/lib/_internal/compiler/implementation/deferred_load.dart b/sdk/lib/_internal/compiler/implementation/deferred_load.dart |
| index 298c7204bec55f56319c2b2e547f2051b9386842..56d26b4c078bc172a13894361cfbd07ff47e9e53 100644 |
| --- a/sdk/lib/_internal/compiler/implementation/deferred_load.dart |
| +++ b/sdk/lib/_internal/compiler/implementation/deferred_load.dart |
| @@ -26,7 +26,8 @@ import 'elements/elements.dart' show |
| MetadataAnnotation, |
| ScopeContainerElement, |
| PrefixElement, |
| - ClosureContainer; |
| + ClosureContainer, |
| + STATE_DONE; |
| import 'util/util.dart' show |
| Link; |
| @@ -303,6 +304,7 @@ class DeferredLoadTask extends CompilerTask { |
| void _collectAllElementsAndConstantsResolvedFrom(Element element, |
| Set<Element> elements, |
| Set<Constant> constants) { |
| + // TODO(sigurdm): How is metadata on a patch-class handled? |
| element = element.implementation; |
|
Johnni Winther
2014/04/01 13:20:00
Remove this line.
sigurdm
2014/04/01 13:57:44
Done.
|
| for (MetadataAnnotation metadata in element.metadata) { |
| if (metadata.value != null) { |
| @@ -442,10 +444,26 @@ class DeferredLoadTask extends CompilerTask { |
| // things to the output units for the library. |
| List<MirrorUsage> mirrorUsages = mirrorsResult[library]; |
| if (mirrorUsages == null) continue; |
| + |
| + void mapDependenciesIfResolved(Element element) { |
| + // If there is a target for this class, but no use of mirrors the |
| + // class will not be resolved. We just skip it. |
| + if (element.isClass() && |
|
karlklose
2014/04/01 13:48:18
Consider using an is-test here, as you expect a su
sigurdm
2014/04/01 13:57:44
Done.
|
| + (element as ClassElement).resolutionState != STATE_DONE) { |
|
Johnni Winther
2014/04/01 13:20:00
Use `!isResolved` instead of `resolutionState != S
sigurdm
2014/04/01 13:57:44
Done.
|
| + return; |
| + } |
| + _mapDependencies(element, deferredImport); |
| + } |
| + |
| for (MirrorUsage usage in mirrorUsages) { |
| if (usage.targets != null) { |
| for (Element dependency in usage.targets) { |
| - _mapDependencies(dependency, deferredImport); |
| + if (dependency.isLibrary()) { |
| + LibraryElement library = dependency; |
| + library.forEachLocalMember(mapDependenciesIfResolved); |
| + } else { |
| + mapDependenciesIfResolved(dependency); |
| + } |
| } |
| } |
| if (usage.metaTargets != null) { |
| @@ -484,10 +502,14 @@ class DeferredLoadTask extends CompilerTask { |
| } |
| } |
| if (usesMirrors) { |
| - for (Link link in compiler.enqueuer.allElementsByName.values) { |
| - for (Element dependency in link) { |
| - _mapDependencies(dependency, deferredImport); |
| - } |
| + // Add all resolved elements to the output unit. |
| + for (Element element in |
| + compiler.enqueuer.resolution.resolvedElements.keys) { |
| + _mapDependencies(element, deferredImport); |
| + } |
| + for (Element element in |
| + compiler.mirrorDependencies.otherDependencies) { |
| + _mapDependencies(element, deferredImport); |
| } |
| } |
| } |