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