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

Unified Diff: runtime/vm/parser.cc

Issue 2825843003: Fix VM crash when encountering an assignment expression in a case expression. (Closed)
Patch Set: Created 3 years, 8 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 | tests/language/case_expression_with_assignment_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index 5a00eed55abd78bcab906aab20fb82157e5c0c77..8706a10540b3185c1426fe7a79a1cecd2f701ab5 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -11472,12 +11472,11 @@ AstNode* Parser::ParseExpr(bool require_compiletime_const,
}
const Token::Kind assignment_op = CurrentToken();
const TokenPosition assignment_pos = TokenPos();
- ConsumeToken();
- const TokenPosition right_expr_pos = TokenPos();
- if (require_compiletime_const && (assignment_op != Token::kASSIGN)) {
- ReportError(right_expr_pos,
+ if (require_compiletime_const) {
+ ReportError(assignment_pos,
"expression is not a valid compile-time constant");
}
+ ConsumeToken();
AstNode* right_expr = ParseExpr(require_compiletime_const, consume_cascades);
if (assignment_op != Token::kASSIGN) {
// Compound assignment: store inputs with side effects into temp. locals.
« no previous file with comments | « no previous file | tests/language/case_expression_with_assignment_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698