Chromium Code Reviews| Index: sdk/lib/_internal/compiler/implementation/js_backend/backend.dart |
| diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart b/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart |
| index 56bf967f898966410c89688f59d86c500995affa..0c458035632808d9254a7fcea5e6c41013129204 100644 |
| --- a/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart |
| +++ b/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart |
| @@ -1750,7 +1750,28 @@ class JavaScriptBackend extends Backend { |
| preMirrorsMethodCount = generatedCode.length; |
| } |
| - if (isTreeShakingDisabled) enqueuer.enqueueEverything(); |
| + if (isTreeShakingDisabled) { |
| + enqueuer.enqueueEverything(); |
| + } else if (!targetsUsed.isEmpty && enqueuer.isResolutionQueue) { |
|
kasperl
2014/01/30 14:14:48
I'd still prefer a helper method that finds all th
floitsch
2014/01/30 15:03:45
done.
Also refactored so it recursively traverses
|
| + // Add all static elements (not classes) that have been requested for |
| + // reflection. If there is no mirror-usage these are probably not |
| + // necessary, but the backend relies on them being resolved. |
| + List staticFields = []; |
| + for (Element target in targetsUsed) { |
| + if (target == null) continue; |
| + if (target.isField()) { |
| + staticFields.add(target); |
| + } else if (target.isLibrary() || target.isClass()) { |
| + ScopeContainerElement container = target; |
| + container.forEachLocalMember((Element member) { |
| + if (!member.isInstanceMember() && member.isField()) { |
| + staticFields.add(member); |
| + } |
| + }); |
| + } |
| + } |
| + enqueuer.enqueueReflectiveStaticFields(staticFields); |
| + } |
| if (mustPreserveNames) compiler.log('Preserving names.'); |