Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Unified Diff: pkg/compiler/lib/src/js_backend/mirrors_data.dart

Issue 2915343002: Revert "Only call MirrorsData.retainMetadata* from codegen" (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/js_backend/mirrors_analysis.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js_backend/mirrors_data.dart
diff --git a/pkg/compiler/lib/src/js_backend/mirrors_data.dart b/pkg/compiler/lib/src/js_backend/mirrors_data.dart
index f1234365d82d3e357f73ae515de4280ff6ef9ff1..62c947b477c39b824cb8273de4b8eb5503a0cb7b 100644
--- a/pkg/compiler/lib/src/js_backend/mirrors_data.dart
+++ b/pkg/compiler/lib/src/js_backend/mirrors_data.dart
@@ -124,7 +124,8 @@ abstract class MirrorsData {
@deprecated
bool isAccessibleByReflection(Element element);
- bool retainMetadataOfLibrary(LibraryEntity element);
+ bool retainMetadataOfLibrary(LibraryEntity element,
+ {bool addForEmission: true});
bool retainMetadataOfTypedef(TypedefElement element);
bool retainMetadataOfClass(ClassEntity element);
bool retainMetadataOfMember(MemberEntity element);
@@ -290,23 +291,26 @@ class MirrorsDataImpl implements MirrorsData, MirrorsDataBuilder {
}
@override
- bool retainMetadataOfLibrary(LibraryElement element) {
+ bool retainMetadataOfLibrary(LibraryElement element,
+ {bool addForEmission: true}) {
if (mustRetainMetadata) {
hasRetainedMetadata = true;
if (isLibraryReferencedFromMirrorSystem(element)) {
- _retainMetadataOf(element);
+ _retainMetadataOf(element, addForEmission: addForEmission);
return true;
}
}
return false;
}
- void _retainMetadataOf(Element element) {
- assert(_compiler.phase == Compiler.PHASE_COMPILING);
+ void _retainMetadataOf(Element element, {bool addForEmission: true}) {
for (MetadataAnnotation metadata in element.metadata) {
+ metadata.ensureResolved(_compiler.resolution);
ConstantValue constant = _constants.getConstantValueForMetadata(metadata);
- CodegenWorldBuilder worldBuilder = _compiler.codegenWorldBuilder;
- worldBuilder.addCompileTimeConstantForEmission(constant);
+ if (addForEmission) {
+ CodegenWorldBuilder worldBuilder = _compiler.codegenWorldBuilder;
+ worldBuilder.addCompileTimeConstantForEmission(constant);
+ }
}
}
« no previous file with comments | « pkg/compiler/lib/src/js_backend/mirrors_analysis.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698