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

Side by Side Diff: runtime/vm/parser.cc

Issue 2498863002: Map deleted enum values to a sentinel value. (Closed)
Patch Set: asiva review 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
« no previous file with comments | « runtime/vm/object_reload.cc ('k') | runtime/vm/symbols.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4836 matching lines...) Expand 10 before | Expand all | Expand 10 after
4847 enum_value.RecordStore(ordinal_value); 4847 enum_value.RecordStore(ordinal_value);
4848 i++; 4848 i++;
4849 4849
4850 ConsumeToken(); // Enum value name. 4850 ConsumeToken(); // Enum value name.
4851 if (CurrentToken() == Token::kCOMMA) { 4851 if (CurrentToken() == Token::kCOMMA) {
4852 ConsumeToken(); 4852 ConsumeToken();
4853 } 4853 }
4854 } 4854 }
4855 ExpectToken(Token::kRBRACE); 4855 ExpectToken(Token::kRBRACE);
4856 4856
4857 const Type& array_type = Type::Handle(Z, Type::ArrayType());
4857 // Add static field 'const List values'. 4858 // Add static field 'const List values'.
4858 Field& values_field = Field::ZoneHandle(Z); 4859 Field& values_field = Field::ZoneHandle(Z);
4859 values_field = 4860 values_field =
4860 Field::New(Symbols::Values(), 4861 Field::New(Symbols::Values(),
4861 /* is_static = */ true, 4862 /* is_static = */ true,
4862 /* is_final = */ true, 4863 /* is_final = */ true,
4863 /* is_const = */ true, 4864 /* is_const = */ true,
4864 /* is_reflectable = */ true, cls, 4865 /* is_reflectable = */ true, cls, array_type, 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 = Field::New(Symbols::_DeletedEnumSentinel(),
4871 /* is_static = */ true,
4872 /* is_final = */ true,
4873 /* is_const = */ true,
4874 /* is_reflectable = */ false, cls,
4875 Object::dynamic_type(), cls.token_pos());
4876 enum_members.AddField(deleted_enum_sentinel);
4877
4868 // Allocate the immutable array containing the enumeration values. 4878 // Allocate the immutable array containing the enumeration values.
4869 // The actual enum instance values will be patched in later. 4879 // The actual enum instance values will be patched in later.
4870 const Array& values_array = Array::Handle(Z, Array::New(i, Heap::kOld)); 4880 const Array& values_array = Array::Handle(Z, Array::New(i, Heap::kOld));
4871 values_field.SetStaticValue(values_array, true); 4881 values_field.SetStaticValue(values_array, true);
4872 values_field.RecordStore(values_array); 4882 values_field.RecordStore(values_array);
4873 4883
4874 // Clone the _name field from the helper class. 4884 // Clone the _name field from the helper class.
4875 Field& _name_field = Field::Handle( 4885 Field& _name_field = Field::Handle(
4876 Z, helper_class.LookupInstanceFieldAllowPrivate(Symbols::_name())); 4886 Z, helper_class.LookupInstanceFieldAllowPrivate(Symbols::_name()));
4877 ASSERT(!_name_field.IsNull()); 4887 ASSERT(!_name_field.IsNull());
(...skipping 9628 matching lines...) Expand 10 before | Expand all | Expand 10 after
14506 const ArgumentListNode& function_args, 14516 const ArgumentListNode& function_args,
14507 const LocalVariable* temp_for_last_arg, 14517 const LocalVariable* temp_for_last_arg,
14508 bool is_super_invocation) { 14518 bool is_super_invocation) {
14509 UNREACHABLE(); 14519 UNREACHABLE();
14510 return NULL; 14520 return NULL;
14511 } 14521 }
14512 14522
14513 } // namespace dart 14523 } // namespace dart
14514 14524
14515 #endif // DART_PRECOMPILED_RUNTIME 14525 #endif // DART_PRECOMPILED_RUNTIME
OLDNEW
« no previous file with comments | « runtime/vm/object_reload.cc ('k') | runtime/vm/symbols.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698