| 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 a49b8ead214852ea0275c6931d8d04f0ab8b9b62..ab3b05e0f98e02ddc4bb3dbf527a9c6c91003a10 100644
|
| --- a/pkg/analyzer/lib/src/generated/parser.dart
|
| +++ b/pkg/analyzer/lib/src/generated/parser.dart
|
| @@ -2330,6 +2330,9 @@ class Parser {
|
| bool foundNamedArgument = argument is NamedExpression;
|
| bool generatedError = false;
|
| while (_optional(TokenType.COMMA)) {
|
| + if (parseTrailingCommas && _matches(TokenType.CLOSE_PAREN)) {
|
| + break;
|
| + }
|
| argument = parseArgument();
|
| arguments.add(argument);
|
| if (argument is NamedExpression) {
|
| @@ -6118,6 +6121,21 @@ class Parser {
|
| // TODO(brianwilkerson) Improve the detection and reporting of missing and
|
| // mismatched delimiters.
|
| type = _currentToken.type;
|
| +
|
| + // Advance past trailing commas as appropriate.
|
| + if (parseTrailingCommas && type == TokenType.COMMA) {
|
| + // Only parse commas trailing normal (non-positional/named) params.
|
| + if (rightSquareBracket == null && rightCurlyBracket == null) {
|
| + Token next = _peek();
|
| + if (next.type == TokenType.CLOSE_PAREN ||
|
| + next.type == TokenType.CLOSE_CURLY_BRACKET ||
|
| + next.type == TokenType.CLOSE_SQUARE_BRACKET) {
|
| + _advance();
|
| + type = _currentToken.type;
|
| + }
|
| + }
|
| + }
|
| +
|
| if (type == TokenType.CLOSE_SQUARE_BRACKET) {
|
| rightSquareBracket = getAndAdvance();
|
| if (leftSquareBracket == null) {
|
|
|