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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/parser.h" 5 #include "vm/parser.h"
6 #include "vm/flags.h" 6 #include "vm/flags.h"
7 7
8 #ifndef DART_PRECOMPILED_RUNTIME 8 #ifndef DART_PRECOMPILED_RUNTIME
9 9
10 #include "lib/invocation_mirror.h" 10 #include "lib/invocation_mirror.h"
(...skipping 4847 matching lines...) Expand 10 before | Expand all | Expand 10 after
4858 Field& values_field = Field::ZoneHandle(Z); 4858 Field& values_field = Field::ZoneHandle(Z);
4859 values_field = 4859 values_field =
4860 Field::New(Symbols::Values(), 4860 Field::New(Symbols::Values(),
4861 /* is_static = */ true, 4861 /* is_static = */ true,
4862 /* is_final = */ true, 4862 /* is_final = */ true,
4863 /* is_const = */ true, 4863 /* is_const = */ true,
4864 /* is_reflectable = */ true, cls, 4864 /* is_reflectable = */ true, cls,
4865 Type::Handle(Z, Type::ArrayType()), cls.token_pos()); 4865 Type::Handle(Z, Type::ArrayType()), cls.token_pos());
4866 enum_members.AddField(values_field); 4866 enum_members.AddField(values_field);
4867 4867
4868 // Add static field 'const _deleted_enum_sentinel'.
4869 Field& deleted_enum_sentinel = Field::ZoneHandle(Z);
4870 deleted_enum_sentinel =
4871 Field::New(Symbols::_DeletedEnumSentinel(),
4872 /* is_static = */ true,
4873 /* is_final = */ true,
4874 /* is_const = */ true,
4875 /* is_reflectable = */ false, cls,
4876 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.
4877 enum_members.AddField(deleted_enum_sentinel);
4878
4868 // Allocate the immutable array containing the enumeration values. 4879 // Allocate the immutable array containing the enumeration values.
4869 // The actual enum instance values will be patched in later. 4880 // The actual enum instance values will be patched in later.
4870 const Array& values_array = Array::Handle(Z, Array::New(i, Heap::kOld)); 4881 const Array& values_array = Array::Handle(Z, Array::New(i, Heap::kOld));
4871 values_field.SetStaticValue(values_array, true); 4882 values_field.SetStaticValue(values_array, true);
4872 values_field.RecordStore(values_array); 4883 values_field.RecordStore(values_array);
4873 4884
4874 // Clone the _name field from the helper class. 4885 // Clone the _name field from the helper class.
4875 Field& _name_field = Field::Handle( 4886 Field& _name_field = Field::Handle(
4876 Z, helper_class.LookupInstanceFieldAllowPrivate(Symbols::_name())); 4887 Z, helper_class.LookupInstanceFieldAllowPrivate(Symbols::_name()));
4877 ASSERT(!_name_field.IsNull()); 4888 ASSERT(!_name_field.IsNull());
(...skipping 9628 matching lines...) Expand 10 before | Expand all | Expand 10 after
14506 const ArgumentListNode& function_args, 14517 const ArgumentListNode& function_args,
14507 const LocalVariable* temp_for_last_arg, 14518 const LocalVariable* temp_for_last_arg,
14508 bool is_super_invocation) { 14519 bool is_super_invocation) {
14509 UNREACHABLE(); 14520 UNREACHABLE();
14510 return NULL; 14521 return NULL;
14511 } 14522 }
14512 14523
14513 } // namespace dart 14524 } // namespace dart
14514 14525
14515 #endif // DART_PRECOMPILED_RUNTIME 14526 #endif // DART_PRECOMPILED_RUNTIME
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698