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

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

Issue 2961063002: Allow trailing comma in assert (Closed)
Patch Set: Created 3 years, 6 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_fasta_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 158d093368ca1b8225c2a49359dbd30a98229af3..2b383646f3415a546bd498af3c6d343bbb039383 100644
--- a/pkg/analyzer/lib/src/generated/parser.dart
+++ b/pkg/analyzer/lib/src/generated/parser.dart
@@ -801,10 +801,19 @@ class Parser {
Expression message;
if (_matches(TokenType.COMMA)) {
comma = getAndAdvance();
- message = parseExpression2();
+ if (_matches(TokenType.CLOSE_PAREN)) {
+ comma = null;
+ } else {
+ message = parseExpression2();
+ if (_matches(TokenType.COMMA)) {
+ getAndAdvance();
+ }
+ }
}
Token rightParen = _expect(TokenType.CLOSE_PAREN);
Token semicolon = _expect(TokenType.SEMICOLON);
+ // TODO(brianwilkerson) We should capture the trailing comma in the AST, but
+ // that would be a breaking change, so we drop it for now.
return astFactory.assertStatement(
keyword, leftParen, expression, comma, message, rightParen, semicolon);
}
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/parser_fasta_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698