Index: pkg/compiler/lib/src/js_backend/constant_emitter.dart |
diff --git a/pkg/compiler/lib/src/js_backend/constant_emitter.dart b/pkg/compiler/lib/src/js_backend/constant_emitter.dart |
index e88d927fdb8f4c819941282cc2f2106576f21723..eba60d909afa435a26f701e80e7717659c0b9b2a 100644 |
--- a/pkg/compiler/lib/src/js_backend/constant_emitter.dart |
+++ b/pkg/compiler/lib/src/js_backend/constant_emitter.dart |
@@ -285,7 +285,7 @@ class ConstantEmitter implements ConstantValueVisitor<jsAst.Expression, Null> { |
@override |
jsAst.Expression visitConstructed(ConstructedConstantValue constant, [_]) { |
- Element element = constant.type.element; |
+ ClassElement element = constant.type.element; |
if (backend.isForeign(element) && element.name == 'JS_CONST') { |
StringConstantValue str = constant.fields.values.single; |
String value = str.primitiveValue.slowToString(); |
@@ -293,9 +293,10 @@ class ConstantEmitter implements ConstantValueVisitor<jsAst.Expression, Null> { |
} |
jsAst.Expression constructor = |
backend.emitter.constructorAccess(constant.type.element); |
- List<jsAst.Expression> fields = constant.fields.values |
- .map(constantReferenceGenerator) |
- .toList(growable: false); |
+ List<jsAst.Expression> fields = <jsAst.Expression>[]; |
+ element.forEachInstanceField((_, FieldElement field) { |
+ fields.add(constantReferenceGenerator(constant.fields[field])); |
+ }, includeSuperAndInjectedMembers: true); |
jsAst.New instantiation = new jsAst.New(constructor, fields); |
return maybeAddTypeArguments(constant.type, instantiation); |
} |