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

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

Issue 900683002: Fix for issue 22178 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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 2d94dd0aafff19c4dd7c3edb1a9a053e390a6b6e..3787d756636318153da51c7b98d43558ed379b59 100644
--- a/pkg/analyzer/lib/src/generated/parser.dart
+++ b/pkg/analyzer/lib/src/generated/parser.dart
@@ -6084,6 +6084,9 @@ class Parser {
} else {
name = _createSyntheticIdentifier();
}
+ if (commentAndMetadata.metadata.isNotEmpty) {
+ _reportErrorForNode(ParserErrorCode.ANNOTATION_ON_ENUM_CONSTANT, commentAndMetadata.metadata[0]);
+ }
return new EnumConstantDeclaration(
commentAndMetadata.comment,
commentAndMetadata.metadata,
@@ -6110,7 +6113,7 @@ class Parser {
Token rightBracket = null;
if (_matches(TokenType.OPEN_CURLY_BRACKET)) {
leftBracket = _expect(TokenType.OPEN_CURLY_BRACKET);
- if (_matchesIdentifier()) {
+ if (_matchesIdentifier() || _matches(TokenType.AT)) {
constants.add(_parseEnumConstantDeclaration());
} else if (_matches(TokenType.COMMA) &&
_tokenMatchesIdentifier(_peek())) {
@@ -10015,6 +10018,10 @@ class ParserErrorCode extends ErrorCode {
'ABSTRACT_TYPEDEF',
"Type aliases cannot be declared to be 'abstract'");
+ static const ParserErrorCode ANNOTATION_ON_ENUM_CONSTANT = const ParserErrorCode(
+ 'ANNOTATION_ON_ENUM_CONSTANT',
+ "Enum constants cannot have annotations");
+
static const ParserErrorCode ASSERT_DOES_NOT_TAKE_ASSIGNMENT =
const ParserErrorCode(
'ASSERT_DOES_NOT_TAKE_ASSIGNMENT',
« 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