Index: pkg/compiler/lib/src/js_backend/mirrors_analysis.dart |
diff --git a/pkg/compiler/lib/src/js_backend/mirrors_analysis.dart b/pkg/compiler/lib/src/js_backend/mirrors_analysis.dart |
index 26468e128a9ed80bc1f8dc1e164eb97996f92871..5f62b6e5998c5e58f58e827e099e296f02bfc9b5 100644 |
--- a/pkg/compiler/lib/src/js_backend/mirrors_analysis.dart |
+++ b/pkg/compiler/lib/src/js_backend/mirrors_analysis.dart |
@@ -73,14 +73,17 @@ class MirrorsResolutionAnalysisImpl implements MirrorsResolutionAnalysis { |
}); |
} |
- for (Element target in _mirrorsData.targetsUsed) { |
- if (target == null) continue; |
+ for (MemberElement target in _mirrorsData.membersInMirrorsUsedTargets) { |
if (target.isField) { |
staticFields.add(target); |
- } else if (target.isLibrary || target.isClass) { |
- addFieldsInContainer(target); |
} |
} |
+ for (ClassElement target in _mirrorsData.classesInMirrorsUsedTargets) { |
+ addFieldsInContainer(target); |
+ } |
+ for (LibraryElement target in _mirrorsData.librariesInMirrorsUsedTargets) { |
+ addFieldsInContainer(target); |
+ } |
return staticFields; |
} |
@@ -107,7 +110,9 @@ class MirrorsResolutionAnalysisImpl implements MirrorsResolutionAnalysis { |
if (_mirrorsData.isTreeShakingDisabled) { |
enqueuer.applyImpact(_computeImpactForReflectiveElements(recentClasses, |
enqueuer.processedClasses, _compiler.libraryLoader.libraries)); |
- } else if (!_mirrorsData.targetsUsed.isEmpty) { |
+ } else if (_mirrorsData.membersInMirrorsUsedTargets.isNotEmpty || |
+ _mirrorsData.classesInMirrorsUsedTargets.isNotEmpty || |
+ _mirrorsData.librariesInMirrorsUsedTargets.isNotEmpty) { |
// 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. |
@@ -120,7 +125,8 @@ class MirrorsResolutionAnalysisImpl implements MirrorsResolutionAnalysis { |
if (_mirrorsData.mustRetainMetadata) { |
_reporter.log('Retaining metadata.'); |
- _compiler.libraryLoader.libraries.forEach(_mirrorsData.retainMetadataOf); |
+ _compiler.libraryLoader.libraries |
+ .forEach(_mirrorsData.retainMetadataOfLibrary); |
if (!enqueuer.queueIsClosed) { |
/// Register the constant value of [metadata] as live in resolution. |
@@ -243,7 +249,8 @@ class MirrorsCodegenAnalysisImpl implements MirrorsCodegenAnalysis { |
if (_mirrorsData.mustRetainMetadata) { |
_reporter.log('Retaining metadata.'); |
- _compiler.libraryLoader.libraries.forEach(_mirrorsData.retainMetadataOf); |
+ _compiler.libraryLoader.libraries |
+ .forEach(_mirrorsData.retainMetadataOfLibrary); |
for (Dependency dependency in _metadataConstants) { |
_impactBuilder |
@@ -383,7 +390,7 @@ class MirrorsHandler { |
void _enqueueReflectiveSpecialClasses() { |
Iterable<ClassElement> classes = _backend.classesRequiredForReflection; |
for (ClassElement cls in classes) { |
- if (_backend.mirrorsData.referencedFromMirrorSystem(cls)) { |
+ if (_backend.mirrorsData.isClassReferencedFromMirrorSystem(cls)) { |
_logEnqueueReflectiveAction(cls); |
cls.ensureResolved(_resolution); |
impactBuilder |