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

Unified Diff: pkg/analyzer/lib/src/generated/parser.dart

Issue 1709013004: Improve error message (issue 25113) (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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/analyzer/lib/src/generated/error.dart ('k') | pkg/analyzer/test/generated/parser_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/parser.dart
diff --git a/pkg/analyzer/lib/src/generated/parser.dart b/pkg/analyzer/lib/src/generated/parser.dart
index 8863fa95e90b0e30cd546d2f4dcb0a9f604f9632..8ec719a7de2a7dba50572859c073aef72a8ca412 100644
--- a/pkg/analyzer/lib/src/generated/parser.dart
+++ b/pkg/analyzer/lib/src/generated/parser.dart
@@ -5459,9 +5459,12 @@ class Parser {
if (constKeyword != null) {
_reportErrorForNode(
ParserErrorCode.CONST_CONSTRUCTOR_WITH_BODY, body);
- } else if (!bodyAllowed) {
+ } else if (externalKeyword != null) {
_reportErrorForNode(
ParserErrorCode.EXTERNAL_CONSTRUCTOR_WITH_BODY, body);
+ } else if (!bodyAllowed) {
+ _reportErrorForNode(
+ ParserErrorCode.REDIRECTING_CONSTRUCTOR_WITH_BODY, body);
}
}
}
@@ -9829,6 +9832,10 @@ class ParserErrorCode extends ErrorCode {
const ParserErrorCode('POSITIONAL_PARAMETER_OUTSIDE_GROUP',
"Positional parameters must be enclosed in square brackets ('[' and ']')");
+ static const ParserErrorCode REDIRECTING_CONSTRUCTOR_WITH_BODY =
+ const ParserErrorCode('REDIRECTING_CONSTRUCTOR_WITH_BODY',
+ "Redirecting constructors cannot have a body");
+
static const ParserErrorCode REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR =
const ParserErrorCode('REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR',
"Only factory constructor can specify '=' redirection.");
« no previous file with comments | « pkg/analyzer/lib/src/generated/error.dart ('k') | pkg/analyzer/test/generated/parser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698