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

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

Issue 713953002: Fix hurt recovery (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 6f6f2b61fb0de56bcf144fd25a7df3e77029d647..7f954635c7a219310aa338230bd86e29339427d6 100644
--- a/pkg/analyzer/lib/src/generated/parser.dart
+++ b/pkg/analyzer/lib/src/generated/parser.dart
@@ -4465,7 +4465,16 @@ class Parser {
period = _expect(TokenType.PERIOD);
}
SimpleIdentifier fieldName = parseSimpleIdentifier();
- if (!_matches(TokenType.EQ)) {
+ Token equals = null;
+ if (_matches(TokenType.EQ)) {
+ equals = andAdvance;
+ } else if (!_matchesKeyword(Keyword.THIS)
+ && !_matchesKeyword(Keyword.SUPER)
+ && !_matches(TokenType.OPEN_CURLY_BRACKET)
+ && !_matches(TokenType.FUNCTION)) {
+ _reportErrorForCurrentToken(ParserErrorCode.MISSING_ASSIGNMENT_IN_INITIALIZER);
+ equals = _createSyntheticToken(TokenType.EQ);
+ } else {
_reportErrorForCurrentToken(ParserErrorCode.MISSING_ASSIGNMENT_IN_INITIALIZER);
return new ConstructorFieldInitializer(
keyword,
@@ -4474,7 +4483,6 @@ class Parser {
_createSyntheticToken(TokenType.EQ),
_createSyntheticIdentifier());
}
- Token equals = _expect(TokenType.EQ);
bool wasInInitializer = _inInitializer;
_inInitializer = true;
try {
« 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