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

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

Issue 987633002: Better recovery (issue 22693) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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 | « 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 e491d91589158ff385d4730b469aaf4faad97cd9..e918ed8e320921606536fc6f9b9ec5f89eda2970 100644
--- a/pkg/analyzer/lib/src/generated/parser.dart
+++ b/pkg/analyzer/lib/src/generated/parser.dart
@@ -2444,6 +2444,12 @@ class Parser {
// class that was parsed.
_parseClassDeclaration(commentAndMetadata, getAndAdvance());
return null;
+ } else if (_matchesKeyword(Keyword.ENUM)) {
+ _reportErrorForToken(ParserErrorCode.ENUM_IN_CLASS, _peek());
+ // TODO(brianwilkerson) We don't currently have any way to capture the
+ // enum that was parsed.
+ _parseEnumDeclaration(commentAndMetadata);
+ return null;
} else if (_isOperator(_currentToken)) {
//
// We appear to have found an operator declaration without the
@@ -9320,6 +9326,9 @@ class ParserErrorCode extends ErrorCode {
static const ParserErrorCode EMPTY_ENUM_BODY = const ParserErrorCode(
'EMPTY_ENUM_BODY', "An enum must declare at least one constant name");
+ static const ParserErrorCode ENUM_IN_CLASS = const ParserErrorCode(
+ 'ENUM_IN_CLASS', "Enums cannot be declared inside classes");
+
static const ParserErrorCode EQUALITY_CANNOT_BE_EQUALITY_OPERAND =
const ParserErrorCode('EQUALITY_CANNOT_BE_EQUALITY_OPERAND',
"Equality expression cannot be operand of another equality expression.");
« 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