Index: pkg/compiler/lib/src/resolution/members.dart |
diff --git a/pkg/compiler/lib/src/resolution/members.dart b/pkg/compiler/lib/src/resolution/members.dart |
index db8ae1c51e056d9d28a0456a2af0df5b96d1ce41..c1263d061a82db7f85e3c3e6b644ca520525fa3c 100644 |
--- a/pkg/compiler/lib/src/resolution/members.dart |
+++ b/pkg/compiler/lib/src/resolution/members.dart |
@@ -3893,6 +3893,21 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> { |
} |
if (node.isConst) { |
analyzeConstantDeferred(node); |
+ |
+ // TODO(johnniwinther): Compute this in the [ConstructorResolver]. |
+ // Check that the constructor is not deferred. |
+ Send send = node.send.selector.asSend(); |
+ if (send != null) { |
+ // Of the form `const a.b(...)`. |
+ if (compiler.deferredLoadTask.deferredPrefixElement( |
+ send, registry.mapping) != null) { |
+ // `a` is a deferred prefix. |
+ isValidAsConstant = false; |
+ // TODO(johnniwinther): Create an [ErroneousConstantExpression] here |
+ // when constants are only created during resolution. |
+ } |
+ } |
+ |
if (isValidAsConstant && |
constructor.isConst && |
argumentsResult.isValidAsConstant) { |