| 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 e30cfdcd7e496a70befa528d5db98275db08b9fc..90f471633992735dbb78284087be70a589fa56e6 100644
|
| --- a/pkg/compiler/lib/src/resolution/constructors.dart
|
| +++ b/pkg/compiler/lib/src/resolution/constructors.dart
|
| @@ -448,11 +448,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);
|
| + }
|
| }
|
| visitor.scope = oldScope;
|
| return null; // If there was no redirection always return null.
|
|
|