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

Unified Diff: runtime/vm/parser.cc

Issue 2498863002: Map deleted enum values to a sentinel value. (Closed)
Patch Set: Created 4 years, 1 month 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
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index 86264b9b2308c14281548bc15378f97f132ccecb..7932301034d0ed95f7a187326b3a8b741b83f4bb 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -4865,6 +4865,17 @@ void Parser::ParseEnumDefinition(const Class& cls) {
Type::Handle(Z, Type::ArrayType()), cls.token_pos());
enum_members.AddField(values_field);
+ // Add static field 'const _deleted_enum_sentinel'.
+ Field& deleted_enum_sentinel = Field::ZoneHandle(Z);
+ deleted_enum_sentinel =
+ Field::New(Symbols::_DeletedEnumSentinel(),
+ /* is_static = */ true,
+ /* is_final = */ true,
+ /* is_const = */ true,
+ /* is_reflectable = */ false, cls,
+ Type::Handle(Z, Type::ArrayType()), cls.token_pos());
siva 2016/11/14 22:18:23 Type::Handle(Z, Type::ArrayType()) could be hoiste
Cutch 2016/11/15 22:13:55 Done.
+ enum_members.AddField(deleted_enum_sentinel);
+
// Allocate the immutable array containing the enumeration values.
// The actual enum instance values will be patched in later.
const Array& values_array = Array::Handle(Z, Array::New(i, Heap::kOld));

Powered by Google App Engine
This is Rietveld 408576698