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

Unified Diff: runtime/vm/parser.cc

Issue 18649003: Partial solution to analyze potentially constant expressions (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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
Index: runtime/vm/parser.cc
===================================================================
--- runtime/vm/parser.cc (revision 24704)
+++ runtime/vm/parser.cc (working copy)
@@ -1904,6 +1904,10 @@
}
receiver->set_invisible(false);
SetAllowFunctionLiterals(saved_mode);
+ if (current_function().is_const() && !init_expr->IsPotentiallyConst()) {
+ ErrorMsg(field_pos,
+ "initializer expression must be compile time constant.");
+ }
Field& field = Field::ZoneHandle(cls.LookupInstanceField(field_name));
if (field.IsNull()) {
ErrorMsg(field_pos, "unresolved reference to instance field '%s'",

Powered by Google App Engine
This is Rietveld 408576698