dart2js: Do not emit type metadata for fields declared in non-reflectable classes.

BUG=
R=karlklose@google.com, zarah@google.com

Review URL: https://codereview.chromium.org//1169453005
This commit is contained in:
Stephan Herhut 2015-06-08 11:27:22 +02:00
parent 3d5f2b45bf
commit 67537ffbd7

View file

@ -161,7 +161,12 @@ class ClassEmitter extends CodeEmitterHelper {
fieldCode = FIELD_CODE_CHARACTERS[code - FIRST_FIELD_CODE];
}
}
if (backend.isAccessibleByReflection(fieldElement)) {
// Fields can only be reflected if their declaring class is reflectable
// (as they are only accessible via [ClassMirror.declarations]. However,
// set/get operations can be performed on them, so they are reflectable
// in some sense.
if (backend.isAccessibleByReflection(fieldElement) &&
backend.isAccessibleByReflection(fieldElement.enclosingClass)) {
DartType type = fieldElement.type;
reflectionMarker = '-${task.metadataCollector.reifyType(type)}';
}