| Index: sdk/lib/_internal/compiler/implementation/resolution/members.dart
|
| diff --git a/sdk/lib/_internal/compiler/implementation/resolution/members.dart b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
|
| index aca4608e3a976031939e4b2b60844cf9b84ffe5c..64593e7a1c5babdbf71b61221f43ce56faacaf3c 100644
|
| --- a/sdk/lib/_internal/compiler/implementation/resolution/members.dart
|
| +++ b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
|
| @@ -361,11 +361,17 @@ class ResolverTask extends CompilerTask {
|
| error(tree, MessageKind.PATCH_EXTERNAL_WITHOUT_IMPLEMENTATION);
|
| return;
|
| }
|
| - if (isConstructor) {
|
| + if (isConstructor || element.isFactoryConstructor()) {
|
| if (tree.returnType != null) {
|
| error(tree, MessageKind.CONSTRUCTOR_WITH_RETURN_TYPE);
|
| }
|
| + if (element.modifiers.isConst() &&
|
| + tree.hasBody() &&
|
| + !tree.isRedirectingFactory) {
|
| + compiler.reportError(tree, MessageKind.CONST_CONSTRUCTOR_HAS_BODY);
|
| + }
|
| }
|
| +
|
| ResolverVisitor visitor = visitorFor(element);
|
| visitor.useElement(tree, element);
|
| visitor.setupFunction(tree, element);
|
| @@ -1238,8 +1244,10 @@ class InitializerResolver {
|
| resolveSuperOrThisForSend(constructor, functionNode, call);
|
| resolvedSuper = true;
|
| } else if (Initializers.isConstructorRedirect(call)) {
|
| - // Check that there is no body (Language specification 7.5.1).
|
| - if (functionNode.hasBody()) {
|
| + // Check that there is no body (Language specification 7.5.1). If the
|
| + // constructor is also const, we already reported an error in
|
| + // [resolveMethodElement].
|
| + if (functionNode.hasBody() && !constructor.modifiers.isConst()) {
|
| error(functionNode, MessageKind.REDIRECTING_CONSTRUCTOR_HAS_BODY);
|
| }
|
| // Check that there are no other initializers.
|
|
|