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'", |