Index: pkg/compiler/lib/src/resolution/resolution.dart |
diff --git a/pkg/compiler/lib/src/resolution/resolution.dart b/pkg/compiler/lib/src/resolution/resolution.dart |
index ca1d268e7805278ade4e2ab04c1382ce42b6989c..b0fc586dd35d659b86ca568a0d7f2b9d98e949c8 100644 |
--- a/pkg/compiler/lib/src/resolution/resolution.dart |
+++ b/pkg/compiler/lib/src/resolution/resolution.dart |
@@ -224,7 +224,7 @@ class ResolverTask extends CompilerTask { |
WorldImpact resolveMethodElementImplementation( |
FunctionElement element, FunctionExpression tree) { |
return reporter.withCurrentElement(element, () { |
- if (element.isExternal && tree.hasBody()) { |
+ if (element.isExternal && tree.hasBody) { |
reporter.reportErrorMessage( |
element, |
MessageKind.EXTERNAL_WITH_BODY, |
@@ -235,11 +235,14 @@ class ResolverTask extends CompilerTask { |
reporter.reportErrorMessage( |
tree, MessageKind.CONSTRUCTOR_WITH_RETURN_TYPE); |
} |
- if (element.isConst && |
- tree.hasBody() && |
- !tree.isRedirectingFactory) { |
- reporter.reportErrorMessage( |
- tree, MessageKind.CONST_CONSTRUCTOR_OR_FACTORY_WITH_BODY); |
+ if (tree.hasBody && element.isConst) { |
+ if (element.isGenerativeConstructor) { |
+ reporter.reportErrorMessage( |
+ tree, MessageKind.CONST_CONSTRUCTOR_WITH_BODY); |
+ } else if (!tree.isRedirectingFactory) { |
+ reporter.reportErrorMessage( |
+ tree, MessageKind.CONST_FACTORY); |
+ } |
} |
} |