| 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..30d0c468f6008440c2c20c51b51a8b5b8748d852 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) {
|
| + // 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.');
|
|
|
|
|