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

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

Issue 1589663002: fixes #25407, generic list and map literal type comments (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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 de0306f68f7c9a3cc8eca99b9598f94f1bbd2b18..6c57f4e81b46fa05bca46a1eee313cb8b2860f56 100644
--- a/pkg/analyzer/lib/src/generated/parser.dart
+++ b/pkg/analyzer/lib/src/generated/parser.dart
@@ -5369,12 +5369,12 @@ class Parser {
*/
Expression _parseConstExpression() {
Token keyword = _expectKeyword(Keyword.CONST);
- if (_matches(TokenType.OPEN_SQUARE_BRACKET) || _matches(TokenType.INDEX)) {
+ if (_matches(TokenType.LT) || _injectGenericCommentTypeList()) {
+ return _parseListOrMapLiteral(keyword);
+ } else if (_matches(TokenType.OPEN_SQUARE_BRACKET) || _matches(TokenType.INDEX)) {
return _parseListLiteral(keyword, null);
} else if (_matches(TokenType.OPEN_CURLY_BRACKET)) {
return _parseMapLiteral(keyword, null);
- } else if (_matches(TokenType.LT)) {
- return _parseListOrMapLiteral(keyword);
}
return _parseInstanceCreationExpression(keyword);
}
@@ -7394,11 +7394,6 @@ class Parser {
return new IntegerLiteral(token, value);
} else if (_matches(TokenType.STRING)) {
return parseStringLiteral();
- } else if (_matches(TokenType.OPEN_CURLY_BRACKET)) {
- return _parseMapLiteral(null, null);
- } else if (_matches(TokenType.OPEN_SQUARE_BRACKET) ||
- _matches(TokenType.INDEX)) {
- return _parseListLiteral(null, null);
} else if (_matchesIdentifier()) {
// TODO(brianwilkerson) The code below was an attempt to recover from an
// error case, but it needs to be applied as a recovery only after we
@@ -7431,8 +7426,13 @@ class Parser {
} finally {
_inInitializer = wasInInitializer;
}
- } else if (_matches(TokenType.LT)) {
+ } else if (_matches(TokenType.LT) || _injectGenericCommentTypeList()) {
return _parseListOrMapLiteral(null);
+ } else if (_matches(TokenType.OPEN_CURLY_BRACKET)) {
+ return _parseMapLiteral(null, null);
+ } else if (_matches(TokenType.OPEN_SQUARE_BRACKET) ||
+ _matches(TokenType.INDEX)) {
+ return _parseListLiteral(null, null);
} else if (_matches(TokenType.QUESTION) &&
_tokenMatches(_peek(), TokenType.IDENTIFIER)) {
_reportErrorForCurrentToken(
« 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