Chromium Code Reviews| Index: runtime/vm/parser.cc |
| diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc |
| index 7819cd780ac26f66bf7a1621d56cd8d5c8611bac..d4b3e6943137328308dceb84aec9ec922b3a9157 100644 |
| --- a/runtime/vm/parser.cc |
| +++ b/runtime/vm/parser.cc |
| @@ -2031,6 +2031,14 @@ void Parser::ParseFormalParameters(bool allow_explicit_default_values, |
| params->has_optional_named_parameters = true; |
| return; |
| } |
| + Token::Kind terminator = |
| + params->has_optional_positional_parameters ? Token::kRBRACK : |
| + params->has_optional_named_parameters ? Token::kRBRACE : |
| + Token :: kRPAREN; |
| + if (CurrentToken() == terminator) { |
|
hausner
2016/06/22 17:50:25
You are allowing an empty list of optional positio
Lasse Reichstein Nielsen
2016/06/24 11:43:04
Good point.
Curiously, it's only an empty named b
|
| + // Allow a trailing comma. |
| + break; |
| + } |
| ParseFormalParameter(allow_explicit_default_values, |
| evaluate_metadata, |
| params); |
| @@ -11125,6 +11133,10 @@ ArgumentListNode* Parser::ParseActualParameters( |
| ASSERT((CurrentToken() == Token::kLPAREN) || |
| (CurrentToken() == Token::kCOMMA)); |
| ConsumeToken(); |
| + if (CurrentToken() == Token::kRPAREN) { |
| + // Allow trailing comma. |
| + break; |
| + } |
| if (IsIdentifier() && (LookaheadToken(1) == Token::kCOLON)) { |
| named_argument_seen = true; |
| // The canonicalization of the arguments descriptor array built in |