Index: pkg/compiler/lib/src/compile_time_constants.dart |
diff --git a/pkg/compiler/lib/src/compile_time_constants.dart b/pkg/compiler/lib/src/compile_time_constants.dart |
index c5462dbff1a5d13d93a11d81fd01b8fe0ebd52ca..c16a09ceba8378ce060892a619fe6d0c31164acc 100644 |
--- a/pkg/compiler/lib/src/compile_time_constants.dart |
+++ b/pkg/compiler/lib/src/compile_time_constants.dart |
@@ -871,14 +871,16 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> { |
ConstructorEvaluator evaluator = new ConstructorEvaluator( |
constructedType, target, handler, compiler); |
evaluator.evaluateConstructorFieldValues(normalizedArguments); |
- List<AstConstant> fieldConstants = |
+ Map<FieldElement, AstConstant> fieldConstants = |
evaluator.buildFieldConstants(classElement); |
- |
+ Map<FieldElement, ConstantValue> fieldValues = |
+ <FieldElement, ConstantValue>{}; |
+ fieldConstants.forEach((FieldElement field, AstConstant astConstant) { |
+ fieldValues[field] = astConstant.value; |
+ }); |
return new AstConstant( |
context, node, new ConstructedConstantExpression( |
- new ConstructedConstantValue( |
- constructedType, |
- fieldConstants.map((e) => e.value).toList()), |
+ new ConstructedConstantValue(constructedType, fieldValues), |
type, |
constructor, |
callStructure, |
@@ -1098,8 +1100,10 @@ class ConstructorEvaluator extends CompileTimeConstantEvaluator { |
/// Builds a normalized list of the constant values for each field in the |
/// inheritance chain of [classElement]. |
- List<AstConstant> buildFieldConstants(ClassElement classElement) { |
- List<AstConstant> fieldConstants = <AstConstant>[]; |
+ Map<FieldElement, AstConstant> buildFieldConstants( |
+ ClassElement classElement) { |
+ Map<FieldElement, AstConstant> fieldConstants = |
+ <FieldElement, AstConstant>{}; |
classElement.implementation.forEachInstanceField( |
(ClassElement enclosing, FieldElement field) { |
AstConstant fieldValue = fieldValues[field]; |
@@ -1108,7 +1112,7 @@ class ConstructorEvaluator extends CompileTimeConstantEvaluator { |
fieldValue = new AstConstant.fromDefaultValue( |
field, handler.compileConstant(field)); |
} |
- fieldConstants.add(fieldValue); |
+ fieldConstants[field] = fieldValue; |
}, |
includeSuperAndInjectedMembers: true); |
return fieldConstants; |