Chromium Code Reviews| Index: runtime/vm/parser.cc |
| =================================================================== |
| --- runtime/vm/parser.cc (revision 15422) |
| +++ runtime/vm/parser.cc (working copy) |
| @@ -2976,21 +2976,18 @@ |
| if (IsIdentifier() && |
| (CurrentLiteral()->Equals(members->class_name()) || member.has_factory)) { |
| if (member.has_factory) { |
| - // TODO(regis): Simplify this code once the core library is fixed. |
| - // See issue 6641. |
| - // Per specification, the name of the factory must be the name of the |
| - // immediately enclosing class. |
| - |
| - // The factory name may be qualified. |
| + // The factory name may be qualified, but the first identifier must match |
| + // the name of the immediately enclosing class. |
| QualIdent factory_name; |
| ParseQualIdent(&factory_name); |
|
hausner
2012/11/28 00:26:38
Does it still make sense to use ParseQualIdent now
regis
2012/11/28 01:09:18
You are right. I simplified this code further.
|
| member.name_pos = factory_name.ident_pos; |
| member.name = factory_name.ident; // Unqualified identifier. |
| - // The class of the factory result type is specified by the factory name. |
| - LibraryPrefix& lib_prefix = LibraryPrefix::Handle(); |
| - if (factory_name.lib_prefix != NULL) { |
| - lib_prefix = factory_name.lib_prefix->raw(); |
| + if ((factory_name.lib_prefix != NULL) || |
| + !member.name->Equals(members->class_name())) { |
| + ErrorMsg("factory name must be '%s'", |
| + members->class_name().ToCString()); |
| } |
| + LibraryPrefix& lib_prefix = LibraryPrefix::Handle(); |
| const Object& result_type_class = Object::Handle( |
| UnresolvedClass::New(lib_prefix, |
| *factory_name.ident, |
| @@ -9003,7 +9000,7 @@ |
| } |
| } else { |
| // Factory call at runtime. |
| - String& factory_class_name = String::Handle(Symbols::MapImplementation()); |
| + String& factory_class_name = String::Handle(Symbols::Map()); |
| const Class& factory_class = |
| Class::Handle(LookupCoreClass(factory_class_name)); |
| ASSERT(!factory_class.IsNull()); |