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 4592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4603 } | 4603 } |
4604 | 4604 |
4605 | 4605 |
4606 void Parser::ParseEnumDefinition(const Class& cls) { | 4606 void Parser::ParseEnumDefinition(const Class& cls) { |
4607 TRACE_PARSER("ParseEnumDefinition"); | 4607 TRACE_PARSER("ParseEnumDefinition"); |
4608 INC_STAT(thread(), num_classes_parsed, 1); | 4608 INC_STAT(thread(), num_classes_parsed, 1); |
4609 | 4609 |
4610 SkipMetadata(); | 4610 SkipMetadata(); |
4611 ExpectToken(Token::kENUM); | 4611 ExpectToken(Token::kENUM); |
4612 | 4612 |
4613 const String& enum_name = String::Handle(Z, cls.PrettyName()); | 4613 const String& enum_name = String::Handle(Z, cls.ScrubbedName()); |
4614 ClassDesc enum_members(Z, cls, enum_name, false, cls.token_pos()); | 4614 ClassDesc enum_members(Z, cls, enum_name, false, cls.token_pos()); |
4615 | 4615 |
4616 // Add instance field 'final int index'. | 4616 // Add instance field 'final int index'. |
4617 Field& index_field = Field::ZoneHandle(Z); | 4617 Field& index_field = Field::ZoneHandle(Z); |
4618 const Type& int_type = Type::Handle(Z, Type::IntType()); | 4618 const Type& int_type = Type::Handle(Z, Type::IntType()); |
4619 index_field = Field::New(Symbols::Index(), | 4619 index_field = Field::New(Symbols::Index(), |
4620 false, // Not static. | 4620 false, // Not static. |
4621 true, // Field is final. | 4621 true, // Field is final. |
4622 false, // Not const. | 4622 false, // Not const. |
4623 true, // Is reflectable. | 4623 true, // Is reflectable. |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4701 // Initialize the field with the ordinal value. It will be patched | 4701 // Initialize the field with the ordinal value. It will be patched |
4702 // later with the enum constant instance. | 4702 // later with the enum constant instance. |
4703 const Smi& ordinal_value = Smi::Handle(Z, Smi::New(i)); | 4703 const Smi& ordinal_value = Smi::Handle(Z, Smi::New(i)); |
4704 enum_value.SetStaticValue(ordinal_value, true); | 4704 enum_value.SetStaticValue(ordinal_value, true); |
4705 enum_value.RecordStore(ordinal_value); | 4705 enum_value.RecordStore(ordinal_value); |
4706 i++; | 4706 i++; |
4707 | 4707 |
4708 // For the user-visible name of the enumeration value, we need to | 4708 // For the user-visible name of the enumeration value, we need to |
4709 // unmangle private names. | 4709 // unmangle private names. |
4710 if (enum_ident->CharAt(0) == '_') { | 4710 if (enum_ident->CharAt(0) == '_') { |
4711 *enum_ident = String::IdentifierPrettyName(*enum_ident); | 4711 *enum_ident = String::ScrubName(*enum_ident); |
4712 } | 4712 } |
4713 enum_value_name = Symbols::FromConcat(name_prefix, *enum_ident); | 4713 enum_value_name = Symbols::FromConcat(name_prefix, *enum_ident); |
4714 enum_names.Add(enum_value_name, Heap::kOld); | 4714 enum_names.Add(enum_value_name, Heap::kOld); |
4715 | 4715 |
4716 ConsumeToken(); // Enum value name. | 4716 ConsumeToken(); // Enum value name. |
4717 if (CurrentToken() == Token::kCOMMA) { | 4717 if (CurrentToken() == Token::kCOMMA) { |
4718 ConsumeToken(); | 4718 ConsumeToken(); |
4719 } | 4719 } |
4720 } | 4720 } |
4721 ExpectToken(Token::kRBRACE); | 4721 ExpectToken(Token::kRBRACE); |
(...skipping 9701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14423 const ArgumentListNode& function_args, | 14423 const ArgumentListNode& function_args, |
14424 const LocalVariable* temp_for_last_arg, | 14424 const LocalVariable* temp_for_last_arg, |
14425 bool is_super_invocation) { | 14425 bool is_super_invocation) { |
14426 UNREACHABLE(); | 14426 UNREACHABLE(); |
14427 return NULL; | 14427 return NULL; |
14428 } | 14428 } |
14429 | 14429 |
14430 } // namespace dart | 14430 } // namespace dart |
14431 | 14431 |
14432 #endif // DART_PRECOMPILED_RUNTIME | 14432 #endif // DART_PRECOMPILED_RUNTIME |
OLD | NEW |