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

Unified Diff: pkg/compiler/lib/src/js_emitter/old_emitter/class_emitter.dart

Issue 1169453005: dart2js: Ensure that typevariables of superclasses are also emitted. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Indentation fix Created 5 years, 6 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 | « no previous file | sdk/lib/_internal/compiler/js_lib/js_mirrors.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js_emitter/old_emitter/class_emitter.dart
diff --git a/pkg/compiler/lib/src/js_emitter/old_emitter/class_emitter.dart b/pkg/compiler/lib/src/js_emitter/old_emitter/class_emitter.dart
index dc1f7da028f625417cb7b05660134ce13b7311fc..b95c6648237f4dec3b222c5f58edcb91b61aca8a 100644
--- a/pkg/compiler/lib/src/js_emitter/old_emitter/class_emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/old_emitter/class_emitter.dart
@@ -161,9 +161,19 @@ class ClassEmitter extends CodeEmitterHelper {
fieldCode = FIELD_CODE_CHARACTERS[code - FIRST_FIELD_CODE];
}
}
+ // 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, which leads to [isAccessibleByReflection]
+ // reporting `true`.
if (backend.isAccessibleByReflection(fieldElement)) {
- DartType type = fieldElement.type;
- reflectionMarker = '-${task.metadataCollector.reifyType(type)}';
+ if (fieldElement.isTopLevel ||
+ backend.isAccessibleByReflection(fieldElement.enclosingClass)) {
+ DartType type = fieldElement.type;
+ reflectionMarker = '-${task.metadataCollector.reifyType(type)}';
+ } else {
+ reflectionMarker = '-';
+ }
}
String builtFieldname = '$fieldName$fieldCode$reflectionMarker';
builder.addField(builtFieldname);
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/js_lib/js_mirrors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698