| Index: pkg/compiler/lib/src/resolution/constructors.dart
|
| diff --git a/pkg/compiler/lib/src/resolution/constructors.dart b/pkg/compiler/lib/src/resolution/constructors.dart
|
| index 7a4dbc68af735d296d314058213cbcc0a99162b1..a7845793ab7ac18fe8ed3f51ee49ab9301defa41 100644
|
| --- a/pkg/compiler/lib/src/resolution/constructors.dart
|
| +++ b/pkg/compiler/lib/src/resolution/constructors.dart
|
| @@ -424,11 +424,24 @@ class InitializerResolver {
|
| constructorInvocation = resolveImplicitSuperConstructorSend();
|
| }
|
| if (isConst && isValidAsConstant) {
|
| - constructor.constantConstructor = new GenerativeConstantConstructor(
|
| - constructor.enclosingClass.thisType,
|
| - defaultValues,
|
| - fieldInitializers,
|
| - constructorInvocation);
|
| + constructor.enclosingClass.forEachInstanceField((_, FieldElement field) {
|
| + if (!fieldInitializers.containsKey(field)) {
|
| + visitor.resolution.ensureResolved(field);
|
| + // TODO(johnniwinther): Report error if `field.constant` is `null`.
|
| + if (field.constant != null) {
|
| + fieldInitializers[field] = field.constant;
|
| + } else {
|
| + isValidAsConstant = false;
|
| + }
|
| + }
|
| + });
|
| + if (isValidAsConstant) {
|
| + constructor.constantConstructor = new GenerativeConstantConstructor(
|
| + constructor.enclosingClass.thisType,
|
| + defaultValues,
|
| + fieldInitializers,
|
| + constructorInvocation);
|
| + }
|
| }
|
| return null; // If there was no redirection always return null.
|
| }
|
|
|