Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(893)

Unified Diff: pkg/compiler/lib/src/resolution/resolution.dart

Issue 1768143003: Use specific messages for const constructor with body. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/resolution/constructors.dart ('k') | pkg/compiler/lib/src/ssa/builder.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+ }
}
}
« no previous file with comments | « pkg/compiler/lib/src/resolution/constructors.dart ('k') | pkg/compiler/lib/src/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698