| Index: pkg/compiler/lib/src/js_backend/namer.dart
|
| diff --git a/pkg/compiler/lib/src/js_backend/namer.dart b/pkg/compiler/lib/src/js_backend/namer.dart
|
| index 7e426b2c2bfb618cd76eeecf21bddb9c72099328..c41e2b9ea1aff2c361d4fdc245ff4712c7f7c3ab 100644
|
| --- a/pkg/compiler/lib/src/js_backend/namer.dart
|
| +++ b/pkg/compiler/lib/src/js_backend/namer.dart
|
| @@ -1881,6 +1881,29 @@ class ConstantNamingVisitor implements ConstantValueVisitor {
|
| @override
|
| void visitConstructed(ConstructedConstantValue constant, [_]) {
|
| addRoot(constant.type.element.name);
|
| +
|
| + // Recognize enum constants and only include the index.
|
| + final Map<FieldEntity, ConstantValue> fieldMap = constant.fields;
|
| + int size = fieldMap.length;
|
| + if (size == 1 || size == 2) {
|
| + FieldEntity indexField;
|
| + for (FieldEntity field in fieldMap.keys) {
|
| + String name = field.name;
|
| + if (name == 'index') {
|
| + indexField = field;
|
| + } else if (name == '_name') {
|
| + // Ingore _name field.
|
| + } else {
|
| + indexField = null;
|
| + break;
|
| + }
|
| + }
|
| + if (indexField != null) {
|
| + _visit(constant.fields[indexField]);
|
| + return;
|
| + }
|
| + }
|
| +
|
| // TODO(johnniwinther): This should be accessed from a codegen closed world.
|
| codegenWorldBuilder.forEachInstanceField(constant.type.element,
|
| (_, FieldElement field) {
|
|
|