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

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

Issue 705393002: Fix issue 20577 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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 | « no previous file | 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 3084970abd65999132f168ad7129cc78526a5fba..d4001e839c5f58602668194d206d0a0895aaf69c 100644
--- a/pkg/analyzer/lib/src/generated/parser.dart
+++ b/pkg/analyzer/lib/src/generated/parser.dart
@@ -4413,6 +4413,9 @@ class Parser {
initializers.add(_parseConstructorFieldInitializer());
}
} while (_optional(TokenType.COMMA));
+ if (factoryKeyword != null) {
+ _reportErrorForToken(ParserErrorCode.FACTORY_WITH_INITIALIZERS, factoryKeyword, []);
+ }
}
ConstructorName redirectedConstructor = null;
FunctionBody body;
@@ -7944,6 +7947,13 @@ class ParserErrorCode extends ErrorCode {
static const ParserErrorCode FACTORY_TOP_LEVEL_DECLARATION = const ParserErrorCode('FACTORY_TOP_LEVEL_DECLARATION', "Top-level declarations cannot be declared to be 'factory'");
+ static const ParserErrorCode FACTORY_WITH_INITIALIZERS
+ = const ParserErrorCode(
+ 'FACTORY_WITH_INITIALIZERS',
+ "A 'factory' constructor cannot have initializers",
+ "Either remove the 'factory' keyword to make this a generative "
+ "constructor or remove the initializers.");
+
static const ParserErrorCode FACTORY_WITHOUT_BODY = const ParserErrorCode('FACTORY_WITHOUT_BODY', "A non-redirecting 'factory' constructor must have a body");
static const ParserErrorCode FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR = const ParserErrorCode('FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR', "Field initializers can only be used in a constructor");
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/parser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698