Index: runtime/vm/parser.cc |
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc |
index 6f639387c126ac232945dfea4ccc80cac1915855..adf26884e2268e8d12335169cc20e6a8051c7c91 100644 |
--- a/runtime/vm/parser.cc |
+++ b/runtime/vm/parser.cc |
@@ -9697,7 +9697,13 @@ AstNode* Parser::ParseAssertStatement(bool is_const) { |
SkipExpr(); |
if (CurrentToken() == Token::kCOMMA) { |
ConsumeToken(); |
- SkipExpr(); |
+ if (CurrentToken() != Token::kRPAREN) { |
+ SkipExpr(); |
+ if (CurrentToken() == Token::kCOMMA) { |
+ // Allow trailing comma. |
+ ConsumeToken(); |
+ } |
+ } |
} |
ExpectToken(Token::kRPAREN); |
return NULL; |
@@ -9714,12 +9720,18 @@ AstNode* Parser::ParseAssertStatement(bool is_const) { |
TokenPosition message_pos = TokenPosition::kNoSource; |
if (CurrentToken() == Token::kCOMMA) { |
ConsumeToken(); |
- message_pos = TokenPos(); |
- message = ParseExpr(kAllowConst, kConsumeCascades); |
- if (is_const && !message->IsPotentiallyConst()) { |
- ReportError( |
- message_pos, |
- "initializer assert expression must be compile time constant."); |
+ if (CurrentToken() != Token::kRPAREN) { |
+ message_pos = TokenPos(); |
+ message = ParseExpr(kAllowConst, kConsumeCascades); |
+ if (is_const && !message->IsPotentiallyConst()) { |
+ ReportError( |
+ message_pos, |
+ "initializer assert expression must be compile time constant."); |
+ } |
+ if (CurrentToken() == Token::kCOMMA) { |
+ // Allow trailing comma. |
+ ConsumeToken(); |
+ } |
} |
} |
ExpectToken(Token::kRPAREN); |