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

Unified Diff: runtime/vm/parser.cc

Issue 180313003: Fix VM crash when parsing what looks like a closure call during metadata evaluation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: comment Created 6 years, 10 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/lib/lib.status » ('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 907e0ac05f6a1304a8d5e6ea3feb9cad127d871d..ca542df05828749dac18038c4efbeedc10b8e024 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -8570,6 +8570,14 @@ AstNode* Parser::ParseSelectors(AstNode* primary, bool is_cascade) {
} else {
// Left is not a primary node; this must be a closure call.
AstNode* closure = left;
+ if (parsing_metadata_) {
+ // Compiling closure calls involves saving the current context based
+ // on the current function, and metadata has no current function.
+ // Fail early rather than limping along only to discover later that
+ // we parsed something that isn't a compile-time constant.
+ ErrorMsg(closure->token_pos(),
+ "expression is not a valid compile-time constant");
+ }
selector = ParseClosureCall(closure);
}
} else {
« no previous file with comments | « no previous file | tests/lib/lib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698