OLD | NEW |
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 4587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4598 } | 4598 } |
4599 | 4599 |
4600 | 4600 |
4601 void Parser::ParseEnumDefinition(const Class& cls) { | 4601 void Parser::ParseEnumDefinition(const Class& cls) { |
4602 TRACE_PARSER("ParseEnumDefinition"); | 4602 TRACE_PARSER("ParseEnumDefinition"); |
4603 INC_STAT(thread(), num_classes_parsed, 1); | 4603 INC_STAT(thread(), num_classes_parsed, 1); |
4604 | 4604 |
4605 SkipMetadata(); | 4605 SkipMetadata(); |
4606 ExpectToken(Token::kENUM); | 4606 ExpectToken(Token::kENUM); |
4607 | 4607 |
4608 const String& enum_name = String::Handle(Z, cls.PrettyName()); | 4608 const String& enum_name = String::Handle(Z, cls.ScrubbedName()); |
4609 ClassDesc enum_members(Z, cls, enum_name, false, cls.token_pos()); | 4609 ClassDesc enum_members(Z, cls, enum_name, false, cls.token_pos()); |
4610 | 4610 |
4611 // Add instance field 'final int index'. | 4611 // Add instance field 'final int index'. |
4612 Field& index_field = Field::ZoneHandle(Z); | 4612 Field& index_field = Field::ZoneHandle(Z); |
4613 const Type& int_type = Type::Handle(Z, Type::IntType()); | 4613 const Type& int_type = Type::Handle(Z, Type::IntType()); |
4614 index_field = Field::New(Symbols::Index(), | 4614 index_field = Field::New(Symbols::Index(), |
4615 false, // Not static. | 4615 false, // Not static. |
4616 true, // Field is final. | 4616 true, // Field is final. |
4617 false, // Not const. | 4617 false, // Not const. |
4618 true, // Is reflectable. | 4618 true, // Is reflectable. |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4696 // Initialize the field with the ordinal value. It will be patched | 4696 // Initialize the field with the ordinal value. It will be patched |
4697 // later with the enum constant instance. | 4697 // later with the enum constant instance. |
4698 const Smi& ordinal_value = Smi::Handle(Z, Smi::New(i)); | 4698 const Smi& ordinal_value = Smi::Handle(Z, Smi::New(i)); |
4699 enum_value.SetStaticValue(ordinal_value, true); | 4699 enum_value.SetStaticValue(ordinal_value, true); |
4700 enum_value.RecordStore(ordinal_value); | 4700 enum_value.RecordStore(ordinal_value); |
4701 i++; | 4701 i++; |
4702 | 4702 |
4703 // For the user-visible name of the enumeration value, we need to | 4703 // For the user-visible name of the enumeration value, we need to |
4704 // unmangle private names. | 4704 // unmangle private names. |
4705 if (enum_ident->CharAt(0) == '_') { | 4705 if (enum_ident->CharAt(0) == '_') { |
4706 *enum_ident = String::IdentifierPrettyName(*enum_ident); | 4706 *enum_ident = String::ScrubName(*enum_ident); |
4707 } | 4707 } |
4708 enum_value_name = Symbols::FromConcat(name_prefix, *enum_ident); | 4708 enum_value_name = Symbols::FromConcat(name_prefix, *enum_ident); |
4709 enum_names.Add(enum_value_name, Heap::kOld); | 4709 enum_names.Add(enum_value_name, Heap::kOld); |
4710 | 4710 |
4711 ConsumeToken(); // Enum value name. | 4711 ConsumeToken(); // Enum value name. |
4712 if (CurrentToken() == Token::kCOMMA) { | 4712 if (CurrentToken() == Token::kCOMMA) { |
4713 ConsumeToken(); | 4713 ConsumeToken(); |
4714 } | 4714 } |
4715 } | 4715 } |
4716 ExpectToken(Token::kRBRACE); | 4716 ExpectToken(Token::kRBRACE); |
(...skipping 9696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14413 const ArgumentListNode& function_args, | 14413 const ArgumentListNode& function_args, |
14414 const LocalVariable* temp_for_last_arg, | 14414 const LocalVariable* temp_for_last_arg, |
14415 bool is_super_invocation) { | 14415 bool is_super_invocation) { |
14416 UNREACHABLE(); | 14416 UNREACHABLE(); |
14417 return NULL; | 14417 return NULL; |
14418 } | 14418 } |
14419 | 14419 |
14420 } // namespace dart | 14420 } // namespace dart |
14421 | 14421 |
14422 #endif // DART_PRECOMPILED_RUNTIME | 14422 #endif // DART_PRECOMPILED_RUNTIME |
OLD | NEW |